delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/08/21/08:08:14

X-Recipient: archive-cygwin AT delorie DOT 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 AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: /etc/profile
References: <loom DOT 20120821T114938-389 AT post DOT gmane DOT org>
In-Reply-To: <loom.20120821T114938-389@post.gmane.org>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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 AT redhat DOT 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--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019