From nobody@FreeBSD.org  Sun Feb  4 11:36:59 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 2C60B16A401
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  4 Feb 2007 11:36:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D70C13C441
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  4 Feb 2007 11:36:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l14Baw4j021385
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 4 Feb 2007 11:36:58 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l14BawYI021384;
	Sun, 4 Feb 2007 11:36:58 GMT
	(envelope-from nobody)
Message-Id: <200702041136.l14BawYI021384@www.freebsd.org>
Date: Sun, 4 Feb 2007 11:36:58 GMT
From: Neil Hoggarth<neil@hoggarth.me.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mount_msdosfs chokes on "noauto" fstab option
X-Send-Pr-Version: www-3.0

>Number:         108751
>Category:       bin
>Synopsis:       mount_msdosfs(8) chokes on "noauto" fstab option
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    rodrigc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 04 11:40:15 GMT 2007
>Closed-Date:    Tue Feb 06 01:25:52 GMT 2007
>Last-Modified:  Tue Feb 06 01:25:52 GMT 2007
>Originator:     Neil Hoggarth
>Release:        RELENG_6
>Organization:
>Environment:
FreeBSD neilhoggarth-2.dsl.easynet.co.uk 6.2-STABLE FreeBSD 6.2-STABLE #0: Sat Feb  3 15:04:42 GMT 2007     root@neilhoggarth-2.dsl.easynet.co.uk:/usr/obj/home/src/sys/SHADOWFAX  i386
>Description:
I updated my 6-STABLE system on 3rd February, the previous rebuild being on 2nd 
January.

I have the following line in my /etc/fstab file, for mounting a removable USB
flash drive with an MSDOSFS filesystem:

  /dev/da0s1 /flash msdosfs rw,noauto,-m=0777 0 0

Following yesterday's update, the command "mount flash" fails with the error:

  mount_msdosfs: /dev/da0s1: Invalid argument

and the following kernel error is logged:

  mount option <auto> is unknown

If I remove the noauto option then the mount succeeds normally.

I would guess that this change is due CVS revision 1.36.2.1 to
src/sbin/mount_msdosfs/mount_msdosfs.c (Sun Jan 28 18:01:28 2007 UTC by rodrigc).
 
>How-To-Repeat:
List an msdosfs filesystem in /etc/fstab with "noauto" amongst the options.
Attempt to mount it with "mount /mountpointname".

>Fix:

>Release-Note:
>Audit-Trail:

From: Craig Rodrigues <rodrigc@crodrigues.org>
To: Neil Hoggarth <neil@hoggarth.me.uk>
Cc: bug-followup@freebsd.org
Subject: Re: bin/108751: mount_msdosfs chokes on "noauto" fstab option
Date: Mon, 5 Feb 2007 10:24:22 -0500

 --NzB8fVQJ5HfG6fxh
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Sun, Feb 04, 2007 at 11:36:58AM +0000, Neil Hoggarth wrote:
 > and the following kernel error is logged:
 > 
 >   mount option <auto> is unknown
 > 
 
 Can you try the attached patch to mount?
 
 -- 
 Craig Rodrigues        
 rodrigc@crodrigues.org
 
 --NzB8fVQJ5HfG6fxh
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="a.txt"
 
 Index: mount.c
 ===================================================================
 RCS file: /home/ncvs/src/sbin/mount/mount.c,v
 retrieving revision 1.69.2.5
 diff -u -u -r1.69.2.5 mount.c
 --- mount.c	28 Jan 2007 01:24:57 -0000	1.69.2.5
 +++ mount.c	5 Feb 2007 15:23:25 -0000
 @@ -74,7 +74,7 @@
  int	hasopt(const char *, const char *);
  int	ismounted(struct fstab *, struct statfs *, int);
  int	isremountable(const char *);
 -void	mangle(char *, int *, const char **);
 +void	mangle(char *, int *, char *[]);
  char   *update_options(char *, char *, int);
  int	mountfs(const char *, const char *, const char *,
  			int, const char *, const char *);
 @@ -120,6 +120,9 @@
  	0
  };
  
 +static const char userquotaeq[] = "userquota=";
 +static const char groupquotaeq[] = "groupquota=";
 +
  static int
  specified_ro(const char *arg)
  {
 @@ -431,7 +434,7 @@
  	const char *vfstype, *spec, *name, *options, *mntopts;
  	int flags;
  {
 -	const char *argv[100];
 +	char *argv[100];
  	struct statfs sf;
  	pid_t pid;
  	int argc, i, status;
 @@ -483,8 +486,8 @@
  	argc = 0;
  	argv[argc++] = execname;
  	mangle(optbuf, &argc, argv);
 -	argv[argc++] = spec;
 -	argv[argc++] = name;
 +	argv[argc++] = strdup(spec);
 +	argv[argc++] = strdup(name);
  	argv[argc] = NULL;
  
  	if (debug) {
 @@ -631,10 +634,7 @@
  }
  
  void
 -mangle(options, argcp, argv)
 -	char *options;
 -	int *argcp;
 -	const char **argv;
 +mangle(char *options, int *argcp, char *argv[])
  {
  	char *p, *s;
  	int argc;
 @@ -642,16 +642,43 @@
  	argc = *argcp;
  	for (s = options; (p = strsep(&s, ",")) != NULL;)
  		if (*p != '\0') {
 -			if (*p == '-') {
 +			if (strcmp(p, "noauto") == 0) {
 +				/*
 +				 * Do not pass noauto option to nmount().
 +				 * or external mount program.  noauto is
 +				 * only used to prevent mounting a file system
 +				 * when 'mount -a' is specified, and is
 +				 * not a real mount option.
 +				 */
 +				continue;
 +			} else if (strcmp(p, "late") == 0) {
 +				/*
 +				 * "late" is used to prevent certain file
 +				 * systems from being mounted before late
 +				 * in the boot cycle; for instance,
 +				 * loopback NFS mounts can't be mounted
 +				 * before mountd starts.
 +				 */
 +				continue;
 +			} else if (strcmp(p, "userquota") == 0) {
 +				continue;
 +			} else if (strncmp(p, userquotaeq,
 +			    sizeof(userquotaeq) - 1) == 0) {
 +				continue;
 +			} else if (strcmp(p, "groupquota") == 0) {
 +				continue;
 +			} else if (strncmp(p, groupquotaeq,
 +			    sizeof(groupquotaeq) - 1) == 0) {
 +				continue;
 +			} else if (*p == '-') {
  				argv[argc++] = p;
  				p = strchr(p, '=');
  				if (p != NULL) {
  					*p = '\0';
  					argv[argc++] = p+1;
  				}
 -			} else if (strcmp(p, "rw") != 0 &&
 -			    strcmp(p, "late") != 0) {
 -				argv[argc++] = "-o";
 +			} else {
 +				argv[argc++] = strdup("-o");
  				argv[argc++] = p;
  			}
  		}
 
 --NzB8fVQJ5HfG6fxh--

From: Neil Hoggarth <neil@hoggarth.me.uk>
To: Craig Rodrigues <rodrigc@crodrigues.org>
Cc: bug-followup@freebsd.org
Subject: Re: bin/108751: mount_msdosfs chokes on "noauto" fstab option
Date: Mon, 5 Feb 2007 22:04:05 +0000 (GMT)

 On Mon, 5 Feb 2007, Craig Rodrigues wrote:
 
 > Can you try the attached patch to mount?
 
 That works for me. Thanks.
 
 Regards,
 
 Neil.
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/108751: commit references a PR
Date: Tue,  6 Feb 2007 01:16:55 +0000 (UTC)

 rodrigc     2007-02-06 01:16:09 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sbin/mount           mount.c 
   Log:
   MFC: 1.73, 1.74, 1.84
   
   Do not pass "noauto", "userquota", or "groupquota" mount options
   down to nmount() or external mount programs.
   
   PR:                     108751
   Reported and tested by: Neil Hoggarth <neil hoggarth me uk>
   
   Revision  Changes    Path
   1.69.2.6  +39 -12    src/sbin/mount/mount.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: rodrigc 
State-Changed-When: Tue Feb 6 01:25:16 UTC 2007 
State-Changed-Why:  
Fixed in RELENG_6. 


Responsible-Changed-From-To: freebsd-bugs->rodrigc 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Tue Feb 6 01:25:16 UTC 2007 
Responsible-Changed-Why:  
Fixed in RELENG_6. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108751 
>Unformatted:
