Mail Archives: cygwin/2012/08/21/10:39:27
Eric Blake <eblake <at> redhat.com> writes:
> 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.
At that point cygwin1.dll is already loaded and so far I haven't seen anything
not working due to that change. But yes, I didn't think of that, so I'm curious
why it seems to work as nicely as it does.
> A missing /etc/skel is a sign of mis-installation, but extra guards
> won't hurt, I guess.
Specifically, that fail would induce the copy of files from whatever the current
directory is into whatever HOME is set to. I guess that could potentially cause
a lot of damage...
> But you are wrong about the LC_COLLATE command
> having no effect.
I didn't say it doesn't have an effect.
> Remember, the shell is required to expand globbing
> prior to executing a command, but that LC_COLLATE affects how globbing
> is performed.
Yes, I missed that globbing was performed before the change in locale treatment
went active.
> 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).
Yes, that seems like a good idea, even though I can't imagine why LC_ALL would
already be set at that point... OK, it gets imported when I set it from Windows
System Properties. I'll have to think about unsetting these unconditionally,
then.
> 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:
That saves us a fork, so it may even be a net win, on the other hand forking a
subshell saves us the restore of LC_ALL... How about this, then (which doesn't
fork and handles spaces correctly):
profile_d ()
{
for file in /etc/profile.d/*.$1 ; do
[ -e "${file}" ] && . "${file}"
done
unset file
}
and then calling it like this:
LC_ALL=C profile_d *.sh
The "unset file" could also go if the call included a "file= ",
I'd think.
Thanks for having a look.
Regards,
Achim.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -