On Wed, Feb 19, 2025 at 02:14:12PM +0100, Jean Delvare wrote:
> I don't know what you call "non terminal characters",

Sorry, I mixed it up, it should be 'terminal symbol'.

> So escaping the parentheses as you suggest is going to cause trouble.
> And as a matter of fact, your patch breaks the quilt test suite ("make
> check").

'make check' did work for me.

> What problem were you trying to solve in the first place?

SUSE's downstream version of quilt for managing kernel trees there is a
patch which exchanges an awk script with a sed. I tried to transfer the
sed expression back to the awk but failed. Can't really figure out why.

Sed part fails in the test suite where strange file names are tested.
With my change all tests pass.

 -›      ›       awk '
 -›      ›       /^[[:space:]]*'"$(quote_awk_re $before)"'([ \t]|$)/ \
 -›      ›       ›       ›       {
 -›      ›       ›       ›       ›       match($0, 
"^([[:space:]]*)'"$(quote_awk_re $before | sed -e 's:\\:\\\\:g')"'([ \t]|$)", a)
 -›      ›       ›       ›       ›       print a[1] "'"$patch$patch_args"'"
 -›      ›       ›       ›       }
 -›      ›       ›       ›       { print }
 -›      ›       ' "$SERIES" > $tmpfile
 +›      ›       sed -Ee 's/^([[:space:]]*)'"$(quote_sed_re $after)"'([ 
\t]|$).*$/&\n\1'"$(quote_sed_re $patch$patch_args)"'/' \
 +›      ›       ›       "$SERIES" > $tmpfile


quote_sed_re()
{
        echo "$1" | sed -e 's/[][(){}.^$*+?|\\]/\\&/g'
}

input="patches/another:strange(name)"
escaped=$(quote_sed_re "$input")
echo "Escaped: $escaped"

input="patches/{%'}.patch"
escaped=$(quote_sed_re "$input")
echo "Escaped: $escaped"

Escaped: patches/another:strange\(name\)
Escaped: patches/\{%'\}\.patch

_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to