X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Achim Gratz Subject: Re: /etc/profile Date: Tue, 21 Aug 2012 14:38:41 +0000 (UTC) Lines: 69 Message-ID: References: <50337A02 DOT 8070809 AT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Eric Blake 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