quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] [patch 07/26] Escape ASCII hyphen-minus characters used


From: Jean Delvare
Subject: Re: [Quilt-dev] [patch 07/26] Escape ASCII hyphen-minus characters used as such.
Date: Wed, 20 Jul 2022 13:39:59 +0200

Hi Branden,

On Tue, 12 Jul 2022 09:40:52 -0500, G. Branden Robinson wrote:
> At 2018-06-20T11:33:25+0200, Jean Delvare wrote:
> > On Sat, 16 Jun 2018 12:22:39 -0400, g.branden.robinson@gmail.com wrote:  
> > > When a "literal" ASCII 45 hyphen-minus character is desired, it has
> > > to be escaped; this is a requirement going all the way back to Bell
> > > Labs Troff, but is frequently overlooked.  Getting it right enables
> > > accurate cut-and-paste of code examples, filenames, URLs, and so
> > > forth from roff documents prepared for UTF-8 terminal and PDF
> > > output, possibly among others.
> > > 
> > > See section 2.1 of CSTR #54, "Troff User's Manual", Ossanna &
> > > Kernighan <https://www.troff.org/54.pdf>.  
> > 
> > I'm curious why hyphens must be double-escaped (\\) while
> > double-quotes are only escaped once (\)?  
> 
> That appears to be an error on my part.  The extra layer of
> backslash-escaping is necessary because the quilt.1 file is generated by
> make using target rules that process quilt.1.in using the shell's 'read'
> and 'echo' built-in commands.
> 
> A quick experiment reveals that extra escaping is needed in both cases.
> At least with Bash.  I'd be nervous about assuming other shells will
> behave exactly the same, even if they claim POSIX-conformance.
> 
> $ cat > infile
> foo\\bar
> foo\"bar
> $ while read line; do echo "$line"; done < infile
> foo\bar
> foo"bar
> 
> The second line certainly does not remain a *roff comment.

OK, thanks for the explanation.

That being said, my initial question wasn't that good. The real
question isn't why double quotes were escaped only once, by why they
were escaped at all. As I understand it, escaped double quotes are
meant to introduce comments, which is *not* the case here:

> The special value \"\\-\" causes quilt not to read any configuration
> file.

So I believe these escapes should be have been removed (leading to
"\\-"). Not that it utterly matters though, as patch 9/26 is replacing
them with directional quotes anyway, so problem solved.

-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]