[PATCH] winsup/doc/etc.postinstall.cygwin-doc.sh fix shell variable typo

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Dec 21 09:44:00 GMT 2017


On Dec 20 19:26, Brian Inglis wrote:
> On 2017-12-20 16:10, Eric Blake wrote:
> > On 12/20/2017 05:01 PM, Brian Inglis wrote:
> >> ---
> >>   winsup/doc/etc.postinstall.cygwin-doc.sh | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh
> >> b/winsup/doc/etc.postinstall.cygwin-doc.sh
> >> index 2873d9395..935bd94e1 100755
> >> --- a/winsup/doc/etc.postinstall.cygwin-doc.sh
> >> +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh
> >> @@ -52,7 +52,7 @@ fi
> >>   # create User Guide and API PDF and HTML shortcuts
> >>   while read target name desc
> >>   do
> >> -    [ -r $t ] && $mks $CYGWINFORALL -P -n "Cygwin/$name" -d "$desc" -- $target
> >> +    [ -r $target ] && $mks $CYGWINFORALL -P -n "Cygwin/$name" -d "$desc" --
> >> $target
> > 
> > Wrong.  Needs to be [ -r "$target" ] to be properly quoted.
> 
> >From working with Windows paths, I feel I often overdo the quotes: originally
> had both uses quoted, then seeing the diff, took them off again, pre-commit.
> Those are base Cygwin paths - don't *need* quotes - unless you feel shell var
> uses should be quoted just in case, or just in tests?

Eric is right.  You can't really overquote.  Quoting fixes the border
case scenario of an empty path leading to a shell syntax error.

Personally I even prefer "${target}" which, admittedly, is a bit on the
paranoid side, so just ignore it :)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20171221/c08ec1e7/attachment.sig>


More information about the Cygwin-patches mailing list