X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type; q=dns; s=default; b=Csmjd/
	J50ZxmelNysrOhgPENXMZktjrwushxFHdt8YAZoEMuDQ+3GqUQgUayIQPiFSFLFt
	qNvWckjCw7vfwYYgrHGH76EEXFnoDlIzRK44B2mbjDwbqnYBAFpHh46gxo7YQ0qN
	wWHWpnLIYAlf69KOdM3vCVOUde6Yj5mKbIJPQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type; s=default; bh=M4/VzuytOeEi
	UwCTPLJu3OZGRrw=; b=IE57b6kQbWCqAQ2B+2nkdyUB6Hye2Xj2k0yv9e/reWXm
	7O0pu+Zox3Zx9vqpX9o7FZtROPbG/dQ9DNbeLMV2kdqhzrnO5LcAeBTXTxM1iz/W
	IzkSR5BJr4KQs25lQVxkYHVOdwzZE8UuvBbgXtvgwgqU7WqkHmRqwZSYiMPRkIk=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mx1.redhat.com
Message-ID: <540EFA12.6080308@redhat.com>
Date: Tue, 09 Sep 2014 07:01:06 -0600
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: latest cygwin: 'run' problem
References: <54060378.2070108@gmail.com> <5406680D.4030105@verizon.net>	<540761FA.1040902@verizon.net> <87ppfcqyc7.fsf@Rainer.invalid>	<540A600A.6090201@verizon.net> <540A6817.9080207@verizon.net>	<20140906201229.GA9220@phoenix> <20140908174606.GA4187@phoenix>	<1448944831.20140909024857@yandex.ru> <20140909011413.GC4187@phoenix>	<20140909030238.GD4187@phoenix> <87oaup6tpk.fsf@Rainer.invalid>
In-Reply-To: <87oaup6tpk.fsf@Rainer.invalid>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw"
X-IsSubscribed: yes

--sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 09/09/2014 03:15 AM, Achim Gratz wrote:

>=20
> If you want to get this right, you should work it out from the inside.
> You want the cd command to get a directory name from a subcommand that
> may contain spaces, so you need to quote the result:
>=20
> cd "$( ... )"
>=20

If you want to also guarantee that you can change to a relative
directory whose name begins with a -, you need:

cd -- "$( ... )"

> Since the argument you're getting may actually be a filename, you need
> to use the dirname command and quote its argument again:
>=20
> cd "$(/bin/dirname "$(...)")"

Again, if you have the possibility of a relative directory name that
might begin with dash,

cd -- "$(/bin/dirname -- "$(...)")"

>=20
> and dirname gets its argument from cygpath, and the argument to cygpath
> must itself be quoted again:
>=20
> cd "$("$(/bin/dirname "$(/bin/cygpath -u "$1")")")"

Ah - you are using cygpath, which can guarantee an absolute name (and
therefore avoid an argument beginning with dash).

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

iQEcBAEBCAAGBQJUDvoSAAoJEKeha0olJ0NqjlIH/A6oNG4ExTJ1Nrp/Ps5lm9zN
VeyORNdCe8SGvKtmq/RHv2Rz9VzwPkddF2bwqgTz+Bc36RYW4naGxZVoAnLhczO6
1SM6nCAi5oIZyNBzxijQSOOHCIeXnYhEHvlc0ITKLuGXwh0KgGjuIgn3dWiuRt++
84pLTo/hKWM5rHdnGBBDg+Aq5HMChMuoQU/MaVjT9SwROeH7ZahFAio+5QHCNDYp
JZAmawOrTv7fvSydArkp0OKahmyTncp7z0PIftKMviJ0ewxCZdz9bD/McCkKEwjd
DbalUYIcydTucYbip/D8XXY0v5E4/F3wR7RVU71XiIE/PVsIQbvEoO0so7Znmzg=
=/RGT
-----END PGP SIGNATURE-----

--sR7CJlOMvKqFO6nfmpunUOQeLq7aOGARw--
