Bladeren bron

fix(susfs-patches): replace sed with python for function def insertion

sed \n in replacement is version-dependent and can silently mangle
the output. Use python3 re.sub() which handles newlines and tabs
deterministically.
TheWildJames 1 maand geleden
bovenliggende
commit
9de5ea8c19
1 gewijzigde bestanden met toevoegingen van 1 en 1 verwijderingen
  1. 1 1
      .github/actions/susfs-patches/action.yml

+ 1 - 1
.github/actions/susfs-patches/action.yml

@@ -68,7 +68,7 @@ runs:
           perl -i -pe 's/\bmask,\s*mark->ignored_mask/inotify_mark_user_mask(mark)/g' fs/notify/fdinfo.c
           perl -i -pe 's/ignored_mask:%x/ignored_mask:0/g' fs/notify/fdinfo.c
           echo "Adding inotify_mark_user_mask function definition"
-          sed -i 's|^static void inotify_fdinfo(struct seq_file \*m, struct fsnotify_mark \*mark)$|static inline u32 inotify_mark_user_mask(struct fsnotify_mark *mark)\n{\n\treturn mark->mask & IN_ALL_EVENTS;\n}\n\n&|' fs/notify/fdinfo.c
+          python3 -c 'import re;c=open("fs/notify/fdinfo.c").read();c=re.sub(r"^static void inotify_fdinfo\(struct seq_file \*m, struct fsnotify_mark \*mark\)$",lambda m:"static inline u32 inotify_mark_user_mask(struct fsnotify_mark *mark)\n{\n\treturn mark->mask & IN_ALL_EVENTS;\n}\n\n"+m.group(0),c,count=1,flags=re.MULTILINE);open("fs/notify/fdinfo.c","w").write(c)'
         fi
         if [ "${{ inputs.sublevel }}" -ge "197" ]; then
           echo "Applying namespace.c Android 13 5.15 Fake Patch"