From d@scry.dstc.edu.au  Sun Aug 25 18:36:23 1996
Received: from trapdoor.dstc.edu.au (root@trapdoor.dstc.edu.au [130.102.176.12])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id SAA06129
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Aug 1996 18:36:17 -0700 (PDT)
Received: from scry.dstc.edu.au (scry.dstc.edu.au [130.102.176.222]) by trapdoor.dstc.edu.au (8.6.9/8.6.12) with ESMTP id LAA05035; Mon, 26 Aug 1996 11:36:12 +1000
Received: (from d@localhost) by scry.dstc.edu.au (8.7.5/8.6.12) id LAA00617; Mon, 26 Aug 1996 11:36:12 +1000 (EST)
Message-Id: <199608260136.LAA00617@scry.dstc.edu.au>
Date: Mon, 26 Aug 1996 11:36:12 +1000 (EST)
From: David Leonard <d@scry.dstc.edu.au>
Reply-To: leonard@dstc.edu.au
To: FreeBSD-gnats-submit@freebsd.org
Cc: leonard@dstc.edu.au
Subject: swapon -a ignores 'noauto' tags in /etc/fstab
X-Send-Pr-Version: 3.2

>Number:         1542
>Category:       bin
>Synopsis:       swapon -a ignores 'noauto' tags in /etc/fstab
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 25 18:40:01 PDT 1996
>Closed-Date:    Thu Sep 5 23:01:42 PDT 1996
>Last-Modified:  Thu Sep  5 23:01:55 PDT 1996
>Originator:     David Leonard
>Release:        FreeBSD 2.2-CURRENT i386
>Organization:
DSTC, Brisbane, Australia  +61 7 3365 4310
>Environment:

FreeBSD scry.dstc.edu.au 2.2-CURRENT FreeBSD 2.2-CURRENT #0: Fri Aug 16 13:25:02 EST 1996     d@scry.dstc.edu.au:/u1/src/sys/compile/SCRY  i386

>Description:

	swapon -a ignores the 'noauto' tag in /etc/fstab. This 
	(I feel) is inconsistent with the -a option to mount. Since
	they both read from the same file (/etc/fstab) I would have
	thought they both honoured the noauto `option'!

>How-To-Repeat:

In /etc/fstab:

   /dev/wd0s2b			none		swap	sw		0 0
   /dev/wd1b			none		swap	sw,noauto	0 0

reboot, and

   Device      512-blocks     Used    Avail Capacity  Type
   /dev/wd0s2b      65536       64    65344     0%    Interleaved
   /dev/wd1b       131072        0   130944     0%    Interleaved
   Total           196352       64   196288     0%

>Fix:

untested diffs follow:

cvs server: Diffing .
Index: swapon.8
===================================================================
RCS file: /home/leonard/cvsroot/freebsd/src/sbin/swapon/swapon.8,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 swapon.8
*** swapon.8	1996/08/16 00:12:14	1.1.1.1
--- swapon.8	1996/08/26 01:29:27
***************
*** 61,67 ****
  All devices marked as ``sw''
  swap devices in
  .Pa /etc/fstab
! are made available.
  .El
  .Pp
  The second form gives individual block devices as given
--- 61,67 ----
  All devices marked as ``sw''
  swap devices in
  .Pa /etc/fstab
! are made available, unless marked with ``noauto''.
  .El
  .Pp
  The second form gives individual block devices as given
Index: swapon.c
===================================================================
RCS file: /home/leonard/cvsroot/freebsd/src/sbin/swapon/swapon.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 swapon.c
*** swapon.c	1996/08/16 00:12:14	1.1.1.1
--- swapon.c	1996/08/26 01:29:27
***************
*** 76,81 ****
--- 76,83 ----
  		while ((fsp = getfsent()) != NULL) {
  			if (strcmp(fsp->fs_type, FSTAB_SW))
  				continue;
+ 			if (strstr(fsp->fs_mntops, "noauto"))
+ 				continue;
  			if (add(fsp->fs_spec, 1))
  				stat = 1;
  			else
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jkh 
State-Changed-When: Thu Sep 5 23:01:42 PDT 1996 
State-Changed-Why:  
Fix applied, thanks! 
>Unformatted:
