X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-10.4 required=5.0	tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <50337A02.8070809@redhat.com>
Date: Tue, 21 Aug 2012 06:07:30 -0600
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: /etc/profile
References: <loom.20120821T114938-389@post.gmane.org>
In-Reply-To: <loom.20120821T114938-389@post.gmane.org>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig10DBDEAA3BBB241DB9991D75"
X-IsSubscribed: yes
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

--------------enig10DBDEAA3BBB241DB9991D75
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 08/21/2012 04:16 AM, Achim Gratz wrote:
> I'm removing the Windows PATH in my startup scripts since there's nothing=
 in
> there that I think should be accessible from Cygwin.

Unfortunately, at least your windows system dll directory has to be on
PATH, or cygwin1.dll will fail to load, so blindly removing ALL windows
paths from PATH is wrong.

> Also, there are two things in profile that may admit slight improvement (=
a place
> where LC_COLLATE is specified just for one command and better guarding ag=
ainst a
> missing or non-cdable /etc/skel).

A missing /etc/skel is a sign of mis-installation, but extra guards
won't hurt, I guess.  But you are wrong about the LC_COLLATE command
having no effect.  Remember, the shell is required to expand globbing
prior to executing a command, but that LC_COLLATE affects how globbing
is performed.  Therefore, you MUST separate the assignment from
LC_COLLATE from the globbing, if the globbing is to be affected (for
that matter, if LC_ALL is set, then it overrides LC_COLLATE, so it may
be better to patch this particular usage to set LC_ALL instead of
LC_COLLATE).

> @@ -103,7 +107,7 @@
>  # Shell dependent settings
>  profile_d ()
>  {
> -  for file in $(export LC_COLLATE=3DC; echo /etc/profile.d/*.$1); do
> +  for file in $(LC_COLLATE=3DC echo /etc/profile.d/*.$1); do

Given my above arguments, if this changes at all, it should change to:
for file in $(LC_ALL=3DC; echo /etc/profile.d/*.$1); do

but that is not safe for files containing whitespace.  If you want
safety, then we should avoid the $() and use globbing directly, although
it gets much longer with something like this:

saved_LC_ALL=3D$LC_ALL
set_LC_ALL=3D${LC_ALL+set}
LC_ALL=3DC
for file in /etc/profile.d/*.$1; do
  if test $set_LC_ALL
    LC_ALL=3D$saved_LC_ALL
  else
    unset LC_ALL
  fi
  # original loop body
done
if test $set_LC_ALL
  LC_ALL=3D$saved_LC_ALL
else
  unset LC_ALL
fi
unset saved_LC_ALL set_LC_ALL

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


--------------enig10DBDEAA3BBB241DB9991D75
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.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJQM3oDAAoJEKeha0olJ0NqnM4H/RgASLPdX5vQpqcMXHwzzsfZ
GNi3ZbBrtwwBvFkolr9LJibevyfbUMw6XtBvh+5cJg0hcs0f3EqcPNYACjd27vUI
FQT/RIpJBWR4gySY9ATbiC5FPKXlAKYEjDKfZwRvz8adXaytkYkyEkwLLzFrpywn
lFYRENDhXxcCLVGsn0U23R/3EI2YbAZiK0/H34/zeW6LN41hmOBRuWkcRX491A6A
Ax+O7lZfoHdFUSIVU0BwbyAnT+fHcn/BhOQ2VBS1ITPa4BBqc7m7m05L6bTvDYDX
ZAeGrKQbDuw9hwBdHmEbbNmY3lUVyfI9Rn44jNxCyUnBy5XXMgmQmKfTZDvNQDs=
=ux9c
-----END PGP SIGNATURE-----

--------------enig10DBDEAA3BBB241DB9991D75--
