From owner-cvs-all Tue Oct 20 01:36:07 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA22462 for cvs-all-outgoing; Tue, 20 Oct 1998 01:36:07 -0700 (PDT) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.15.68.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id BAA22451; Tue, 20 Oct 1998 01:36:01 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id SAA12989; Tue, 20 Oct 1998 18:35:32 +1000 Date: Tue, 20 Oct 1998 18:35:32 +1000 From: Bruce Evans Message-Id: <199810200835.SAA12989@godzilla.zeta.org.au> To: bde@zeta.org.au, mike@smith.net.au Subject: Re: cvs commit: src/bin/mkdir mkdir.c Cc: cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, msmith@FreeBSD.ORG Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk >> If it compiled, I think it would break the mode for intermediate >> directories created by mkdir -p. > >It would set the all to the mode of the destination directory, where the >goal seems to be to create them 0777 & umask. The intended version >only made the chmod() call if last was set; does this cleave closer to >your expectations? The goal is for the intermediate directories is (0300 | ~umask), i.e., what you would get for a mkdir(2) with mode 777 and the default umask followed by a `chmod u+wx' fixup. The weird 0300 mode is the minimal mode required for creating subdirectories; a stricter mode would require races to restrict it after creating the subdirectory. chmod'ing only the leaf would fix this. The umask fiddling does help get the intermediate modes right without a chmod() fixup. >> This bogotifies the umask() microoptimizations. > >It would be useful to have some idea what this actually means in >context. What microoptimisations? Note that no matter what you >microoptimise umask for, mkdir will still clip anything above 0777. This should be obvious to anyone familiar with the code. The umask is changed so that no chmod() is necessary. This becomes just a pessimization and an obfuscation when a chmod() is done anyway. It is possible to avoid the chmod() except for -m on the leaf directory, but that would bloat the source some more and the patch doesn't attempt it. >> This has some style bugs. > >I'm sure it does. Without an automated style bug detector, you're all >we have. Try indent(1). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message