*BSD News Article 26062


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!bunyip.cc.uq.oz.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!usc!cs.utexas.edu!uunet!zib-berlin.de!news.belwue.de!news.uni-stuttgart.de!tyrell.tynet.sub.org!tyrell.tynet.sub.org!not-for-mail
From: rodney@tyrell.tynet.sub.org (Rodney Volz)
Newsgroups: comp.os.386bsd.bugs
Subject: FreeBSD: UFS bug (and fix)
Date: 15 Jan 1994 15:38:25 +0100
Organization: Tyrell Stuttgart, FRG
Lines: 47
Message-ID: <2h8v5f$78@tyrell.tynet.sub.org>
NNTP-Posting-Host: tyrell.tynet.sub.org

Hello,

IMHO, there's a bug in /usr/src/sys/ufs/ufs_vnops.c concerning
the gid-handling when creating files.

In FreeBSD/ufs, files are always created with their group-id
set to the group-id of their parent-directory. This behaviour
is neither POSIX nor BSD-conforming.

Posix says, that the group-id of newly created files should be set to
the group-id of the creator. An optional Posix feature is, that
if the parent directory has a group S-bit set, the group-id
of the new file should be set to the group-id of its parent
directory.

*** ufs_vnops.c.ORIGINAL	Sat Jan 15 15:02:27 1994
--- ufs_vnops.c	Sat Jan 15 15:35:04 1994
***************
*** 1626,1632 ****
--- 1626,1640 ----
  	}
  	ip = tip;
  	ip->i_uid = ndp->ni_cred->cr_uid;
+ #if 0
  	ip->i_gid = pdir->i_gid;
+ #else
+ 	/* This behaviour should be POSIX conform. -Rodney Volz */
+ 	if (pdir->i_mode & S_ISGID)
+ 		ip->i_gid = pdir->i_gid;
+ 	else
+ 		ip->i_gid = ndp->ni_cred->cr_gid;
+ #endif
  #ifdef QUOTA
  	if ((error = getinoquota(ip)) ||
  	    (error = chkiq(ip, 1, ndp->ni_cred, 0))) {

This patch (for FreeBSD-1.0.2, cd to /usr/src/sys/ufs and apply the
patch there) implements the "enhanced" Posix-Behaviour (which is known
from HPUX, SunOS and some other unix flavours). I'd be happy to see
this patch incorporated in the next FreeBSD release.

-Rodney Volz
-- 
                    Rodney Volz - 70197 Stuttgart - FRG
======================> public access usenet system <========================
rodney@tyrell.tynet.sub.org +49 711 651429 Fax/Data volz@rus.uni-stuttgart.de
 \______________ May your children and mine live in peace. ________________/