Debian Bug report logs - #211614
autofs: mount options are reordered, which could change their meaning

version graph

Package: autofs; Maintainer for autofs is Mike Gabriel <sunweaver@debian.org>; Source for autofs is src:autofs (PTS, buildd, popcon).

Reported by: Teddy Hogeborn <teddy@recompile.se>

Date: Fri, 19 Sep 2003 00:33:02 UTC

Severity: normal

Tags: patch

Found in version 3.9.99-4.0.0pre10-1

Done: "Arthur Korn" <arthur@korn.ch>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Daniel Lutz <danlutz@debian.org>:
Bug#211614; Package autofs. (full text, mbox, link).


Acknowledgement sent to Teddy Hogeborn <teddy@fukt.bth.se>:
New Bug report received and forwarded. Copy sent to Daniel Lutz <danlutz@debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Teddy Hogeborn <teddy@fukt.bth.se>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: autofs: mount options are reordered, which could change their meaning
Date: Fri, 19 Sep 2003 02:24:43 +0200
Package: autofs
Version: 3.9.99-4.0.0pre10-1
Severity: normal
Tags: patch

The order of mount options specified in a NIS auto.master map (maybe
also an /etc/auto.master file, I haven't checked) are reordered by
autofs, so that when mount(8) is called, the options are passed in a
different order than written in auto.master.

Proof:

$ ypcat -k auto.master
/home auto.home defaults,nosuid,nodev,timeo=14,rsize=8192,wsize=8192,soft
$ invoke-rc.d autofs getmounts
/usr/sbin/automount  /home yp auto.home  nosuid,timeo=14,wsize=8192,defaults,soft,rsize=8192,nodev

See how the "nodev" moved from being the second option to being last,
and how the "defaults" option moved from the first to the fourth
postion?  What you would expect is the options to retain the same
order as given.

Reordering the options is bad, because this could alter the options'
meaning.  Excerpt from the mount(8) man page:

----
[...]
              user   Allow  an  ordinary  user  to mount the file
                     system.  The name of the  mounting  user  is
                     written  to  mtab so that he can unmount the
                     file system again.  This option implies  the
                     options  noexec,  nosuid,  and nodev (unless
                     overridden by subsequent options, as in  the
                     option line user,exec,dev,suid).
[...]
----

Here is a patch to /etc/init.d/autofs to make it preserve the order of
the options as given:

----
--- /etc/init.d/autofs.~4~	Fri Jul 21 16:15:54 2000
+++ /etc/init.d/autofs	Sat Jul 22 07:49:07 2000
@@ -180,6 +180,7 @@
 	FS="="
 	daemon_opts[ "timeout" ] = "timeout"
 	daemon_opts[ "t" ] = "timeout"
+	numoptions = 0
 }
 {
 	if ( $0 ~ /^$/ )
@@ -187,7 +188,8 @@
 	if ( $1 in daemon_opts ) {
 		daemon[ daemon_opts[ $1 ] ] = $2
 	} else {
-		mount[$0] = 1
+		numoptions++
+		option[numoptions] = $0
 	}
 }
 END {
@@ -196,11 +198,11 @@
 			printf "--timeout=%s\n", daemon["timeout"]
 		}
 	} else {
-		for ( a in mount ) {
+		for ( a=1; a <= numoptions ; a++ ) {
 			if ( length( out ) )
-				out=out "," a
+				out=out "," option[a]
 			else
-				out=a
+				out=option[a]
 		}
 		printf "%s\n", out
 	}
----

(Tested with both mawk and gawk.)

This bug and patch was previously mentioned in the thread about
another bug (#67294), where the maintainer said he would fix it soon.
Since I was not affected by the bug, I did not file another bug
report.  But the bug is still not fixed, so I am reporting it now.

/Teddy

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux tower 2.4.20 #1 SMP Tue Aug 12 15:26:49 CEST 2003 i686
Locale: LANG=C, LC_CTYPE=en_US.UTF-8

Versions of packages autofs depends on:
ii  libc6                   2.2.5-11.5       GNU C Library: Shared libraries an
ii  procps                  1:2.0.7-8.woody1 The /proc file system utilities.




Message sent on to Teddy Hogeborn <teddy@fukt.bth.se>:
Bug#211614. (full text, mbox, link).


Message #8 received at 211614-submitter@bugs.debian.org (full text, mbox, reply):

From: Petter Reinholdtsen <pere@hungry.com>
To: 211614-submitter@bugs.debian.org
Subject: Re: autofs: mount options are reordered, which could change their meaning
Date: Sun, 21 Sep 2003 14:28:24 +0200
I believe this problem is fixed in version 3.9.99-4.0.0pre10-14.  At
least the code is rewritten so the patch do not apply cleanly, and as
far as I can read the code it is rewritten to keep the order of the
options.



Reply sent to "Arthur Korn" <arthur@korn.ch>:
You have taken responsibility. (full text, mbox, link).


Notification sent to Teddy Hogeborn <teddy@fukt.bth.se>:
Bug acknowledged by developer. (full text, mbox, link).


Message #13 received at 211614-done@bugs.debian.org (full text, mbox, reply):

From: "Arthur Korn" <arthur@korn.ch>
To: 211614-done@bugs.debian.org
Subject: fixed with Bug#147774
Date: Tue, 31 Aug 2004 00:52:24 +0200
fixed with Bug#147774



Bug unarchived. Request was from Teddy Hogeborn <teddy@fukt.bsnet.se> to control@bugs.debian.org. (Sat, 29 Nov 2008 21:34:08 GMT) (full text, mbox, link).


Changed Bug submitter from Teddy Hogeborn <teddy@fukt.bth.se> to Teddy Hogeborn <teddy@fukt.bsnet.se>. Request was from Teddy Hogeborn <teddy@fukt.bsnet.se> to control@bugs.debian.org. (Sat, 29 Nov 2008 21:34:09 GMT) (full text, mbox, link).


Bug archived. Request was from Teddy Hogeborn <teddy@fukt.bsnet.se> to control@bugs.debian.org. (Sat, 29 Nov 2008 21:34:12 GMT) (full text, mbox, link).


Bug unarchived. Request was from Teddy Hogeborn <teddy@recompile.se> to control@bugs.debian.org. (Mon, 10 Oct 2011 08:03:52 GMT) (full text, mbox, link).


Changed Bug submitter to 'Teddy Hogeborn <teddy@recompile.se>' from 'Teddy Hogeborn <teddy@fukt.bsnet.se>' Request was from Teddy Hogeborn <teddy@recompile.se> to control@bugs.debian.org. (Mon, 10 Oct 2011 08:03:52 GMT) (full text, mbox, link).


Bug archived. Request was from Teddy Hogeborn <teddy@recompile.se> to control@bugs.debian.org. (Mon, 10 Oct 2011 08:03:52 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Jul 1 13:14:31 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.