delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/08/25/17:15:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
Message-ID: <38320.12.22.157.254.1061853499.squirrel@mail3411.b0.com>
Date: Mon, 25 Aug 2003 18:18:19 -0500 (CDT)
Subject: BUG: base-files-2.2-1 profile.d runs in subshell - sourced files fail
From: "mike808" <mike808 AT users DOT sourceforge DOT net>
To: <john DOT r DOT morrison AT ntlworld DOT com>, <cygwin AT cygwin DOT com>
X-Priority: 3
Importance: Normal
X-MSMail-Priority: Normal
Reply-To: mike808 AT users DOT sourceforge DOT net
MIME-Version: 1.0

In base-files-2.2-1, the following was recently changed:

> # Run all of the profile.d scripts
> # Note that these are supplied by separate packages
> /bin/find /etc/profile.d -iname '*.sh' -type f | while read f; do
>   if [ -f "$f" ]; then
>     . "$f"
>   fi
> done

Previously, the find was executed as an expanded filename wildcard
expansion as part of a 'for' loop. (c.f. 2.0-2)

When this was changed to the current code, because a pipe is used,
the subsequent commands run in a *sub-shell* of the parent /etc/profile
script executing. This means that any environment changes performed
by the files in /etc/profile.d/ are *lost* when the sub-shell returns
to the parent.

This effectively nullifies any environment changes being performed in
those files. Things like PATH setting, etc. I use them to clean up
environment variables mangled by Rational prior to setting up a shell
in Cygwin.

Please put it back to the way it was in base-files-2.0-2, with
the one exception that quote marks be placed around the "$i" iterator
variable so as to preserve any whitespace that might be in the filenames.

I have corrected that working code (from 2.0-2) below:

> # Run all of the profile.d scripts
> # Note that these are supplied by separate packages
> for i in /etc/profile.d/*.sh ; do
>   if [ -f "$i" ]; then
>     . "$i"
>   fi
> done

Thank you.
Michael/



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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