coreutils ls color (was: another question...)

Ryan Schmidt ryandesign at macports.org
Tue May 10 07:47:38 PDT 2011


On May 10, 2011, at 09:31, Rodolfo Aramayo wrote:

> On Tue, May 10, 2011 at 09:03, Alexander Skwar wrote:
> 
>> are you really sure?
> 
> It works of that I am sure
>  
>> Why should PS1 (the prompt value)
>> have anything to do with ls showing color (or not)? There's
>> no connection between those two settings and your, how
>> you call it, "rationale" doesn't explain this.
> 
> Again. It works.  

Not as far as I can see. Setting PS1 sets your shell prompt; that's all. It has nothing to do with how the ls program or any other program functions. Perhaps there's another line in your profile that you've added that's relevant.


>> Oh, and BTW: What you discovered is IMO *the* prime
>> reason, why it's a BAD idea to have GNU stuff "too early"
>> in the $PATH. Other ("system") tools might expect a certain
>> behaviour after having figured out the operating system. Hence
>> it's bad to have ls/tar/… way up front, if your not really on a GNU
>> system (which you aren't, when you're on OS X).
>> 
> 
> You might be right. I am making the assumption that "system" tools will use Apple paths whereas MacPorts-installed software will use port paths. The fact that Apple uses PS1 call for example in /etc/bashrc file to control Bash behavior gave me the courage to add PS1 calls to my /etc/profile file. Remember this is only controlling terminal behavior. But even if it were not, I can see how things could go wrong if I were forcing the system to JUST use ports compilers, but this is not the case. The programs, ls/tar/ and so on should not really affect system behavior as in they have the same function from those in the system. But again, you might be absolutely right....and if you are, you shall be the first one to know

This thread should have demonstrated to you that GNU ls and BSD ls have differences which can affect how you use them. Perhaps it's unlikely that any build scripts will use ls, or if they do, then they won't use advanced features that might differ. But GNU tar and BSD tar might also have subtle differences that might cause problems for programs that expect the one but find the other. Ideally, programs would check to see what version of these programs are available, but some might make the assumption that, on Mac OS X, the BSD versions are being used, and then might fail oddly if the GNU versions are there instead.

MacPorts used to optionally allow users to install GNU programs without their "g" prefix, thus making them override the BSD versions provided by Mac OS X. This caused many problems within MacPorts so we removed this possibility and changed it to install the unprefixed versions in a separate directory. Users are now welcome to add that unprefixed directory to their PATH if they wish, which at least means that software built using MacPorts will not be affected (because MacPorts does not use your PATH). You can read more about the problem here if you're interested:

https://trac.macports.org/ticket/20748




More information about the macports-users mailing list