Subject: bin/3932: chflags(2) won't accept nonodump flag
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bgrayson@ece.utexas.edu>
List: netbsd-bugs
Date: 08/01/1997 13:56:12
>Number:         3932
>Category:       bin
>Synopsis:       "chflags nonodump foo" does not clear nodump flag.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug  1 12:05:01 1997
>Last-Modified:
>Originator:     Brian Grayson
>Organization:
	Parallel and Distributed Systems
	Electrical and Computer Engineering
	The University of Texas at Austin
>Release:        late July 1997
>Environment:
	
NetBSD marvin 1.2G NetBSD 1.2G (MARVIN) #1: Wed Jul 30 14:23:02 CDT 1997 chase@c3p0:/a/c3p0/home/c3p0/src/sys/arch/i386/compile/MARVIN i386

>Description:
        The man page for chflags(2) says that one should prefix a
	flag name with ``no'' to clear it.  Since there is a flag
	called ``nodump'', this would imply ``nonodump'' would
	clear the flag.  However, chflags only accepts dump, not
	nonodump.

	This could either be considered a doc bug in the man
	page, or a sw-bug in the string_to_flags() routine from ls,
	which is linked in with chflags.  IMHO, it is the
	latter, as adding code to parse double-negatives in the
	flag string is probably a better fix than adding an
	exception to the `prefix "no"' rule in all relevant man
	pages (only chflags so far, I guess).

	The ideal fix would probably be to choose a flag name like
	`skipdump' that wasn't ``active-low'' (for you hardware
	folks!).  Frankly, IMHO, the uchg flag should be called nouchg
	or uimm, since setting uchg makes the user unable to make
	changes (same with schg).

>How-To-Repeat:
% touch foo
% chflags nodump foo
% ls -lo foo
-rw-r--r--  1 bgrayson  wheel  nodump 0 Aug  1 13:49 foo
% chflags nonodump foo
chflags: invalid flag: nonodump
% chflags dump foo
% ls -lo foo
-rw-r--r--  1 bgrayson  wheel  - 0 Aug  1 13:49 foo

>Fix:
	Perhaps one of my above three suggestions (man page,
	string_to_flags routine, or rename of `nodump' option to
	something else that doesn't have `no' in front.)
	
>Audit-Trail:
>Unformatted: