Skip to contentSkip to conversation

Autofs screwed by getopt?

DISCUSSION Michaël Cadilhac 2 participants 6 messages Jul 23, 2007 1 message not in the archive Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi guys!

I have a NIS based automount configuration that reads like that :

lri4-154 linux # ypcat -k auto.master
/special auto.special -rw,intr,soft
/servers auto.servers -rw,intr,soft
/local auto.local -rw,intr,soft
/u auto.u -rw,intr,soft,nosuid
/tmpsim auto.tmpsim -rw,intr,soft
/users auto.users -rw,intr,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2

Didn't seem like a badly formatted one. So I launched autofs, and here's what it said :

* Starting automounter ...
/special/usr/sbin/automount: option -t requires a numeric argument, got r,soft
* Failure on /special
/servers/usr/sbin/automount: option -t requires a numeric argument, got r,soft
* Failure on /servers
/local/usr/sbin/automount: option -t requires a numeric argument, got r,soft
* Failure on /local
/u/usr/sbin/automount: option -t requires a numeric argument, got r,soft,nosuid
* Failure on /u
/tmpsim/usr/sbin/automount: option -t requires a numeric argument, got r,soft
* Failure on /tmpsim
/users/usr/sbin/automount: option -t requires a numeric argument, got r,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2
* Failure on /users

Point is that the -rw,int' is interpreted by the getopt like a bunch of not understood options then a t', as in timeout'. So the next part, e.g. r,soft', is considered as the argument of `timeout' which is not quite good.

What I did is that I removed the short opts for getopt in the init.d script, but I'm not quite sure it's The Right Thing to Do.

Maybe the config got from nis is faulty, if so, just tell me, I'll despise my sysadmin.

Thanks!

PS: In fact, it seems that the mount options are not applied at all. Don't have a clue why.

------------------------------------------------------------------------
lri4-154 linux # automount --version
Linux automount version 4.1.3
lri4-154 linux # uname -a
Linux lri4-154 2.6.22-gentoo-r1 #1 SMP Thu Jul 19 16:20:19 CEST 2007 i686 Intel(R) Pentium(R) 4 CPU 2.80GHz GenuineIntel GNU/Linux
------------------------------------------------------------------------

Signature · 4 lines
 |   Michaël `Micha' Cadilhac       |    Un paradoxe autoréférent ?          |
 |   http://michael.cadilhac.name   |                                        |
 |   JID/MSN:                       |       ... Je dis pas non !             |
 `----  [email protected]  |                                   -  --'

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#1 lore raw

==> On Mon, 23 Jul 2007 15:34:14 +0200, [email protected] (Michaël Cadilhac) said:

Michaël> Hi guys!
Michaël> I have a NIS based automount configuration that reads like that :

Michaël> lri4-154 linux # ypcat -k auto.master
Michaël> /special auto.special -rw,intr,soft
Michaël> /servers auto.servers -rw,intr,soft
Michaël> /local auto.local -rw,intr,soft
Michaël> /u auto.u -rw,intr,soft,nosuid
Michaël> /tmpsim auto.tmpsim -rw,intr,soft
Michaël> /users auto.users -rw,intr,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2

Michaël> Didn't seem like a badly formatted one. So I launched autofs, and here's Michaël> what it said :

Michaël>  * Starting automounter ...
Michaël>  /special/usr/sbin/automount: option -t requires a numeric argument, got r,soft
Michaël>  * Failure on /special
Michaël>  /servers/usr/sbin/automount: option -t requires a numeric argument, got r,soft
Michaël>  * Failure on /servers
Michaël>  /local/usr/sbin/automount: option -t requires a numeric argument, got r,soft
Michaël>  * Failure on /local
Michaël>  /u/usr/sbin/automount: option -t requires a numeric argument, got r,soft,nosuid
Michaël>  * Failure on /u
Michaël>  /tmpsim/usr/sbin/automount: option -t requires a numeric argument, got r,soft
Michaël>  * Failure on /tmpsim
Michaël>  /users/usr/sbin/automount: option -t requires a numeric argument, got r,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2
Michaël>  * Failure on /users

Michaël> Point is that the -rw,int' is interpreted by the getopt like a bunch of Michaël> not understood options then a t', as in timeout'. So the next part, Michaël> e.g. r,soft', is considered as the argument of `timeout' which is not Michaël> quite good.

Michaël> What I did is that I removed the short opts for getopt in the init.d Michaël> script, but I'm not quite sure it's The Right Thing to Do.

Michaël> Maybe the config got from nis is faulty, if so, just tell me, I'll Michaël> despise my sysadmin.

Michaël> Thanks!

Michaël> PS: In fact, it seems that the mount options are not applied at Michaël> all. Don't have a clue why.

Michaël> lri4-154 linux # automount --version
Michaël> Linux automount version 4.1.3

You are most likely running into a bug in the parsing done in the init script. What does '/etc/init.d/autofs status' show?

I have a couple of patches to fix that up. I don't have a gentoo source tree, though. If you can point me at one, I can likely send you a patch to try.

-Jeff

#2 lore raw
Quoted 2 lines · Jeff Moyer

You are most likely running into a bug in the parsing done in the init script. What does '/etc/init.d/autofs status' show?

Well, just `started'.

Quoted 3 lines

I have a couple of patches to fix that up. I don't have a gentoo source tree, though. If you can point me at one, I can likely send you a patch to try.

I'm running a Gentoo, I'm root and all the stuff so I can try your patch.

Michaël> PS: In fact, it seems that the mount options are not applied at Michaël> all. Don't have a clue why.

Seems like :

lri4-154:/dd $ mount
[...]
automount(pid23161) on /special type autofs (rw,fd=4,pgrp=23161,minproto=2,maxproto=4) automount(pid23175) on /servers type autofs (rw,fd=4,pgrp=23175,minproto=2,maxproto=4) automount(pid23190) on /local type autofs (rw,fd=4,pgrp=23190,minproto=2,maxproto=4) automount(pid23204) on /u type autofs (rw,fd=4,pgrp=23204,minproto=2,maxproto=4) automount(pid23218) on /tmpsim type autofs (rw,fd=4,pgrp=23218,minproto=2,maxproto=4) automount(pid23233) on /users type autofs (rw,fd=4,pgrp=23233,minproto=2,maxproto=4)

Signature · 4 lines
 |   Michaël `Micha' Cadilhac       |    Le copillage-collage                |
 |   http://michael.cadilhac.name   |       tue le programmeur.              |
 |   JID/MSN:                       |           -- Dictons LRDE              |
 `----  [email protected]  |                                   -  --'

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 1 line · Jeff Moyer

So, can you get me the output from, 'ps auxwww | grep automount'?

Here you are :-) :

/usr/sbin/automount --pid-file /var/run/autofs.special.pid /special yp auto.special -rw,intr,soft /usr/sbin/automount --pid-file /var/run/autofs.servers.pid /servers yp auto.servers -rw,intr,soft /usr/sbin/automount --pid-file /var/run/autofs.local.pid /local yp auto.local -rw,intr,soft /usr/sbin/automount --pid-file /var/run/autofs.u.pid /u yp auto.u -rw,intr,soft,nosuid
/usr/sbin/automount --pid-file /var/run/autofs.tmpsim.pid /tmpsim yp auto.tmpsim -rw,intr,soft /usr/sbin/automount --pid-file /var/run/autofs.users.pid /users yp auto.users -rw,intr,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2

Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

I have a couple of patches to fix that up. I don't have a gentoo source tree, though. If you can point me at one, I can likely send you a patch to try.

Michaël> I'm running a Gentoo, I'm root and all the stuff so I can try Michaël> your patch.

Yes, but I don't know where to get source packages for gentoo. I'll look into it if I have time.

Here's how autofs is installed :

Quoted 1 line
Quoted 1 line
Quoted 1 line

Emerging (1 of 1) net-fs/autofs-4.1.3-r7 to /

'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-sock-leak-fix.patch' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-strict.patch' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-replicated_server_select.patch' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-miscfixes.patch.gz' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3.tar.bz2' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-non_block_ping.patch' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-mtab_lock.patch' 'http://gentoo.modulix.net/gentoo/distfiles/autofs-4.1.3-bad_chdir.patch'

Quoted 1 line
Quoted 1 line
Quoted 1 line

Unpacking autofs-4.1.3.tar.bz2 to /var/tmp/portage/net-fs/autofs-4.1.3-r7/work

* Applying autofs-4.1.3-strict.patch ...
* Applying autofs-4.1.3-mtab_lock.patch ...
* Applying autofs-4.1.3-bad_chdir.patch ...
* Applying autofs-4.1.3-non_block_ping.patch ...
* Applying autofs-4.1.3-sock-leak-fix.patch ...
* Applying autofs-4.1.3-replicated_server_select.patch ...
* Applying autofs-4.1.3-miscfixes.patch.gz ...
* Applying autofs-4.1.3-signal-race-fix.patch ...

And signal-race-fix.patch is :

daemon/automount.c 2004-08-18 11:24:45.047015256 -0400 renamed from daemon/automount.c.orig 2004-08-18 11:23:49.430470256 -0400 +2 -2
@@ -848,10 +848,10 @@ static int st_prepare_shutdown(void)
        alarm(0);
 
        /* Prevent any new mounts */
-       ap.state = ST_SHUTDOWN_PENDING;
-
        sigprocmask(SIG_SETMASK, &lock_sigs, NULL);
 
+       ap.state = ST_SHUTDOWN_PENDING;
+
        /* Unmount everything */
        exp = expire_proc(1);
 

I've tarball'ed the ending patched directory at
http://www.lrde.org/~cadilh_m/autofs-4.1.3.tar.bz2 .

Thanks !

Signature · 4 lines
 |   Michaël `Micha' Cadilhac       |    Un paradoxe autoréférent ?          |
 |   http://michael.cadilhac.name   |                                        |
 |   JID/MSN:                       |       ... Je dis pas non !             |
 `----  [email protected]  |                                   -  --'

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs

#5 lore raw
In reply to Michaël Cadilhac

==> On Mon, 23 Jul 2007 15:34:14 +0200, [email protected] (Michaël Cadilhac) said:

Michaël> Hi guys!
Michaël> I have a NIS based automount configuration that reads like that :

Michaël> lri4-154 linux # ypcat -k auto.master
Michaël> /special auto.special -rw,intr,soft
Michaël> /servers auto.servers -rw,intr,soft
Michaël> /local auto.local -rw,intr,soft
Michaël> /u auto.u -rw,intr,soft,nosuid
Michaël> /tmpsim auto.tmpsim -rw,intr,soft
Michaël> /users auto.users -rw,intr,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2

Ian pointed out the obvious to me in irc. From the man page for auto.master:

Any remaining command line arguments without leading dashes (-) are taken as options (-o) to mount. Arguments with leading dashes are considered options for the maps.

So, remove the '-' character from the options list and things should work as expected.

-Jeff

#6 lore raw
Quoted 13 lines · Jeff Moyer

==> On Mon, 23 Jul 2007 15:34:14 +0200, [email protected] (Michaël Cadilhac) said:

Michaël> Hi guys!
Michaël> I have a NIS based automount configuration that reads like that :

Michaël> lri4-154 linux # ypcat -k auto.master
Michaël> /special auto.special -rw,intr,soft
Michaël> /servers auto.servers -rw,intr,soft
Michaël> /local auto.local -rw,intr,soft
Michaël> /u auto.u -rw,intr,soft,nosuid
Michaël> /tmpsim auto.tmpsim -rw,intr,soft
Michaël> /users auto.users -rw,intr,hard,nosuid,tcp,nfsvers=3,timeo=600,retrans=2

Quoted 5 lines

Ian pointed out the obvious to me in irc. From the man page for auto.master:

Any remaining command line arguments without leading dashes (-) are taken as options (-o) to mount. Arguments with leading dashes are considered options for the maps.

Damn ; I didn't see that. Well, I guess I'll have to shout (or cry) at my system admin, because I can't do anything to the NIS database myself.

Thank you both :-)

Signature · 4 lines
 |   Michaël `Micha' Cadilhac       |  Si j'étais sous-secrétaire d'État     |
 |   http://michael.cadilhac.name   |    aux choux farcis, vous entendriez   |
 |   JID/MSN:                       |  beaucoup parler des choux farcis !    |
 `----  [email protected]  |          -- Nicolas Sarkozy       -  --'

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs