From c227a9104052074bb8c141541255e038dae79674 Mon Sep 17 00:00:00 2001 From: olf Date: Wed, 19 Jan 2022 23:16:01 +0100 Subject: [PATCH 1/2] pm_apply: Do not quote "+" for BREs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … because BREs are the default for grep and sed (see their man-pages) and in BREs the "+" character has no special meaning, plus https://www.gnu.org/software/sed/manual/sed.html#BRE-vs-ERE --- src/tools/pm_apply | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/pm_apply b/src/tools/pm_apply index 6696f871..104e6e50 100644 --- a/src/tools/pm_apply +++ b/src/tools/pm_apply @@ -101,7 +101,7 @@ mangle_libpath() { sedcmd="" # look for lines to convert, if some are found add pattern to sed scriptlet for p in $candidates; do - cand_lines=$(grep -c "^\+\+\+ [^/]*$p" "$PATCH_PATH") + cand_lines=$(grep -c "^+++ [^/]*$p" "$PATCH_PATH") if [ $cand_lines -eq 0 ]; then continue # nothing found, try next fi @@ -118,7 +118,7 @@ mangle_libpath() { failure fi # append at the front so ';' can be easily used for separation - sedcmd="s@^\+\+\+ \([^/]*\)$p@+++ \1$pr@;s@^--- \([^/]*\)$p@--- \1$pr@;$sedcmd" + sedcmd="s@^+++ \([^/]*\)$p@+++ \1$pr@;s@^--- \([^/]*\)$p@--- \1$pr@;$sedcmd" done if [ $found -eq 0 ]; then From 55cd5297e8fc5a58625e1f23187e0da5d4ac28ed Mon Sep 17 00:00:00 2001 From: olf Date: Wed, 19 Jan 2022 23:21:48 +0100 Subject: [PATCH 2/2] pm_apply: Replace all occurrences of each path pattern MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … with its replacement pattern, instead of only the first occurrence of each path pattern. --- src/tools/pm_apply | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/pm_apply b/src/tools/pm_apply index 104e6e50..83cf7299 100644 --- a/src/tools/pm_apply +++ b/src/tools/pm_apply @@ -118,7 +118,7 @@ mangle_libpath() { failure fi # append at the front so ';' can be easily used for separation - sedcmd="s@^+++ \([^/]*\)$p@+++ \1$pr@;s@^--- \([^/]*\)$p@--- \1$pr@;$sedcmd" + sedcmd="s@^+++ \([^/]*\)$p@+++ \1$pr@g;s@^--- \([^/]*\)$p@--- \1$pr@g;$sedcmd" done if [ $found -eq 0 ]; then