Bug 153303 - ls options as root include -a rather than -A
Summary: ls options as root include -a rather than -A
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: Beta 5
Hardware: 64bit SuSE Linux 10.1
: P5 - None : Enhancement (vote)
Target Milestone: ---
Assignee: Dr. Werner Fink
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-24 08:47 UTC by Benjamin Weber
Modified: 2006-04-27 15:14 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Weber 2006-02-24 08:47:52 UTC
default $LS_OPTIONS as root are 

-a -N --color=tty -T 0

so ls gets aliased to /bin/ls -a -N --color=tty -T 0

this means . and .. are in directory listings, and -A does not override, this can be annoying when trying to for example copy all files starting with .

perhaps -A would be more sensible than -a by default?
Comment 1 Michael Gross 2006-02-24 13:48:58 UTC
I don't think I get your point here. Why is it a problem to copy all hidden files? If you use the shell's file completion feature it will always include `.' and `..'?
Comment 2 Benjamin Weber 2006-02-24 18:42:41 UTC
copying all hidden files was just one example, but can you think of a good reason /for/ having . and .. in the path, given that it causes problems doing some things. 

for example to copy hidden files one could do:

for i in $(ls -A | grep '^\.'); do cp $i /someplace;

but as ls is aliased to "ls -a" then the above copies everything in the current folder, not just the hidden files, as -a overrides -A.
Comment 3 Michael Gross 2006-02-24 19:04:32 UTC
Benjamin, what has `ls' to do with either of your examples? `ls' is no shell-builtin and `cp' neither?

Your example would work because cp would omit `.' and `..' because they are directories. However changing LS_OPTIONS would change nothing of this behaviour.
Comment 4 Benjamin Weber 2006-02-24 19:18:06 UTC
I'm sorry, if I were doing "cp -r" rather than just cp, then . and .. would not be excluded and everything would be copied.

and changing LS_OPTIONS would change this behaviour, as with -a in LS_OPTIONS gives :

lcars:/home/benji # ls -A | head -n 2
.
..

and without -a in LS_OPTIONS gives:

benji@lcars:~> ls -A | head -n 2
.bash_history
.bashrc
Comment 5 Michael Gross 2006-02-24 23:48:59 UTC
OK I got it. You can use quotes with the command this would not apply the alias including the $LS_OPTIONS.

Werner: Please decide what should be done.
Comment 6 Dr. Werner Fink 2006-02-27 11:14:37 UTC
We do nothing.  Root has to see all files even hidden files. This
is a security requirement and will not changed.
Comment 7 Benjamin Weber 2006-02-27 11:30:27 UTC
I think you are misunderstanding, -A still shows all files even hidden files, it just doesn't show "." and ".." (current and parent directories) If you can think of a good reason for including these in the directory listings by default then I'll understand, but afaik other distros all have -A in options by default, not -a.
Comment 8 Dr. Werner Fink 2006-02-27 13:36:35 UTC
OK, I've changed -a to -A
Comment 9 Ludwig Nussel 2006-04-26 14:06:20 UTC
why did you change l and la? I don't care about plain ls but for l -A sucks. I do want to see the permissions of the directory I am in when using l. l is suse specific anyways and I loved it just the way it used to be.
Comment 10 Dr. Werner Fink 2006-04-27 14:36:51 UTC
Please discuss this with Benjamin Weber.
Comment 11 Ludwig Nussel 2006-04-27 14:42:44 UTC
He didn't even mention l or la, only ls.
Comment 12 Dr. Werner Fink 2006-04-27 15:14:31 UTC
OK -A for ls and -a for l and la