Automounter verbose toggle and GNU ls

As I have mentioned before you can turn automounters verbose mode on and off by accessing the file "=v" as root in the root of an automount point. Typically this means "/home/=v" so I would usually do:

# ls /home/=v

and the logging would burst into life. However you need to be sure you don't use the gnu ls (which is the default on OpenSolaris) as if you do you will see in the log file this:

t4 Automountd: verbose on 
t4 Automountd: verbose off 

The reason is clear when you truss the ls:

cjg@brompton:/var/crash/brompton$ pfexec truss -o /tmp/tr ls /home/=v
ls: cannot access /home/=v: No such file or directory
cjg@brompton:/var/crash/brompton$ egrep =v /tmp/tr
stat64("/home/=v", 0x0807A20C)                  Err#2 ENOENT
lstat64("/home/=v", 0x0807A20C)                 Err#2 ENOENT
cjg@brompton:/var/crash/brompton$ 

It accesses the file twice, so toggles verbose mode on and then off. I think this is a bug in the gnu ls since if they did lstat64 first and it returned ENOENT they would not need to do the stat64 at all. Anyway the solaris ls does the right thing:

cjg@brompton:/var/crash/brompton$ pfexec /usr/bin/ls /home/=v
/home/=v: No such file or directory
cjg@brompton:/var/crash/brompton$ tail -1 /var/svc/log/system-filesystem-autofs:default.log
t4      Automountd: verbose on
cjg@brompton:/var/crash/brompton$ 
Comments:

Justification straight from ls.c:

/\* stat failed because of ENOENT, maybe indicating a dangling
symlink. Or stat succeeded, ABSOLUTE_NAME does not refer to a
directory, and --dereference-command-line-symlink-to-dir is
in effect. Fall through so that we call lstat instead. \*/

Posted by Tomasz on December 09, 2008 at 12:22 PM GMT #

It should do the lstat first. Then decide based on that whether they need to do do the stat. The existing code is just adding an extra call that will always fail.

Posted by Chris Gerhard on December 09, 2008 at 12:32 PM GMT #

"ustification straight from ls.c:

/\* stat failed because of ENOENT, maybe indicating a dangling
symlink. Or stat succeeded, ABSOLUTE_NAME does not refer to a
directory, and --dereference-command-line-symlink-to-dir is
in effect. Fall through so that we call lstat instead. \*/"

This is a \*perfect\* example of what I've been saying all along, GNU people think they know UNIX better than the engineers who worked on UNIX for the past 30 years, when in reality they do not understand the subject matter.

\*This\* is why I \*hate\* GNU with a burning passion!

GNU is not UNIX!

Posted by UX-admin on December 09, 2008 at 11:35 PM GMT #

"If you think you have found a bug in Coreutils, then you should send as complete a report as possible to <bug-coreutils@gnu.org>. "

Or you can even send patch, if you believe you know better. Sources at http://www.gnu.org/software/coreutils/

Posted by Tomasz on December 11, 2008 at 11:50 PM GMT #

Go on Chris! Fix it :)

By the way, after hearing about the new "Entry level" GCSE maths papers I think the simple math question needed to post this comment may be too complicated for some :) 6 + 6 = ??

Posted by Jonathan Cowper-Andrewes on December 13, 2008 at 07:11 PM GMT #

Post a Comment:
Comments are closed for this entry.
About

This is the old blog of Chris Gerhard. It has mostly moved to http://chrisgerhard.wordpress.com

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today