Subject: lib/117: setmode(3) doesn't work
To: None <gnats-admin>
From: Harald Daeubler <daeh@physik.uni-ulm.de>
List: netbsd-bugs
Date: 02/10/1994 02:05:10
>Number:         117
>Category:       lib
>Synopsis:       setmode(3) doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 10 02:05:07 1994
>Originator:     Harald Daeubler
>Organization:
	Universitaet Ulm
>Release:        NetBSD-current
>Environment:
	m68k-port NetBSD 0.9a
System: NetBSD theotp9 0.9 THEOTP#1 i386


>Description:
setmode(3) doesnt work correctly for file modes with 'u', 'g' or 'o' on the
rhs of an '=', for example go=u-w.

>How-To-Repeat:
	Try chmod go=u-w file
>Fix:
The bug was introduced recently by a change to src/lib/libc/gen/setmode.c
(see diffs). I couldnt figure out why that change was made, but undoing it
would fix this problem (and perhaps cause others ??)

*** setmode.c	Wed Feb  9 12:56:54 1994
--- setmode.c.old	Wed Feb  9 11:36:25 1994
***************
*** 322,328 ****
  				 * to flush out any partial mode that we have,
  				 * and then do the copying of the mode bits.
  				 */
! 				if (perm || op == '=') {
  					ADDCMD(op, who, perm, mask);
  					perm = 0;
  				}
--- 321,327 ----
  				 * to flush out any partial mode that we have,
  				 * and then do the copying of the mode bits.
  				 */
! 				if (perm) {
  					ADDCMD(op, who, perm, mask);
  					perm = 0;
  				}
***************
*** 338,344 ****
  				 * Add any permissions that we haven't already
  				 * done.
  				 */
! 				if (perm || op == '=') {
  					ADDCMD(op, who, perm, mask);
  					perm = 0;
  				}
--- 337,343 ----
  				 * Add any permissions that we haven't already
  				 * done.
  				 */
! 				if (perm) {
  					ADDCMD(op, who, perm, mask);
  					perm = 0;
  				}
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------