This is the mail archive of the
mailing list for the Cygwin project.
Re: mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise
- From: Eric Blake <eblake at redhat dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 20 Dec 2017 10:02:48 -0600
- Subject: Re: mkshortcut fails when run from setup, postinstall/cygwin-doc.sh - not otherwise
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
On 12/20/2017 06:59 AM, Enrique Perez-Terron wrote:
So I have added a line "set -x" at the top in postinstall/cygwin-doc.sh,
and the relevant section becomes
+ read target name desc
+ '[' -r ']'
(by the way -- this reveals another bug too: The script says "[ -r $t ]
&& $mks ..." where I am sure it should be "[ -r $target ] && $mks ...")
[ -r "$target" ]
It is almost always a bug to use [ ] without quoting "$..." expansions,
because if the expansion of $... is empty, it changes the number of
arguments to [ and thus the test that [ performs.
If your script uses #!/bin/bash, then you can use bashisms like:
[[ -r $target ]]
which do the right thing ('[[' is part of the shell grammar, rather than
treated like an executable; as such, you can safely omit quoting in that
form; but '[[' is not yet POSIX and is not supported on dash).
(and again btw, I am not sure bash should count "[ -r ]" as a true
I am. POSIX requires that behavior. Any time you have exactly one
argument to '[', the result is true unless that argument was the empty
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple