develooper Front page | perl.perl5.porters | Postings from April 2015

[perl #124343] [PATCH] Makefile.SH: Fix quote() function to escape backslashes but not minus signs

From:
Tony Cook via RT
Date:
April 29, 2015 01:36
Subject:
[perl #124343] [PATCH] Makefile.SH: Fix quote() function to escape backslashes but not minus signs
Message ID:
rt-4.0.18-23908-1430271358-743.124343-15-0@perl.org
On Sat Apr 18 11:38:57 2015, ntyni@debian.org wrote:
> The attached proposed patch changes the list of allowed characters to
> include the minus sign and the forward slash but exclude the backslash,
> which is presumably the intended behaviour. The effect of the patch
> can be seen by building in a directory with a minus sign in its name,
> calling Configure with the -Duseshrplib argument, and grepping for
> LD_LIBRARY_PATH in the resulting Makefile. Without the patch, the minus
> sign will be escaped unnecessarily.

I also tested this on NetBSD and HP-UX.

According to:

http://pubs.opengroup.org/onlinepubs/009695399/utilities/sed.html#tag_04_126_13_02

the s/// BRE treats escaped delimiters as a literal delimiter, and doesn't mention any special behaviour in brackets.

But it behaves are you described (HP-UX):

bash-4.3$ echo 'foo bar/\' | sed 's/\([^a-zA-Z0-9.:_/-]\)/\\\1/g' 
foo\ bar/\\
bash-4.3$ echo 'foo bar/\' | sed 's/\([^a-zA-Z0-9.:_\/-]\)/\\\1/g'
foo\ bar/\

I've added this to my post-5.22 branch.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=124343



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About