Hi Daniel,

On Wed, 19 Feb 2025 11:52:38 +0100, Daniel Wagner via Quilt-dev wrote:
> The round brackets are non terminals characters for sed, thus these need
> to be escaped as well.
> 
> Signed-off-by: Daniel Wagner <w...@kernel.org>
> ---
>  quilt/scripts/patchfns.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
> index 1b6406a90274..549c32e4a3ee 100644
> --- a/quilt/scripts/patchfns.in
> +++ b/quilt/scripts/patchfns.in
> @@ -87,7 +87,7 @@ quote_grep_re()
>  # Quote a string for use in a regular expression for a sed s/// command.
>  quote_sed_re()
>  {
> -     echo "$1" | sed -e 's:\([][^$/.*\\]\):\\\1:g'
> +     echo "$1" | sed -e 's:\([][^$/.*\\()]\):\\\1:g'
>  }
>  
>  # Quote a string for use in a regular expression for an awk pattern.

I don't know what you call "non terminal characters", but to GNU sed, a
(unescaped) parenthesis in a regexp matches a parenthesis in the
pattern space. Escaped parentheses have a different meaning, they are
used to record portions of the pattern to be used in the replacement
string.

Example:
$ echo 'a(b)c' | sed -e 's/(/_/'
a_b)c

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").

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

-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
Quilt-dev mailing list
Quilt-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to