Date: Tue, 20 Oct 1998 18:35:32 +1000 From: Bruce Evans <bde@zeta.org.au> To: bde@zeta.org.au, mike@smith.net.au Cc: cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, msmith@FreeBSD.ORG Subject: Re: cvs commit: src/bin/mkdir mkdir.c Message-ID: <199810200835.SAA12989@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810200835.SAA12989>