BUG: base-files-2.2-1 profile.d runs in subshell - sourced files fail

mike808 mike808@users.sourceforge.net
Tue Aug 26 01:00:00 GMT 2003


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/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /