Return to BSD News archive
Received: by minnie.vk1xwt.ampr.org with NNTP id AA6049 ; Mon, 04 Jan 93 16:17:12 EST Newsgroups: comp.unix.bsd Path: sserve!manuel.anu.edu.au!munnari.oz.au!metro!ipso!runxtsa!bde From: bde@runx.oz.au (Bruce Evans) Subject: Re: [386 BSD] Permissions set wrong - HELP Message-ID: <1993Jan6.124711.8827@runx.oz.au> Organization: RUNX Un*x Timeshare. Sydney, Australia. References: <C0618x.6uL@ais.org> <1993Jan1.105359.4807@runx.oz.au> <1id1uiINN6n7@manuel.anu.edu.au> Date: Wed, 6 Jan 93 12:47:11 GMT Lines: 21 In article <1id1uiINN6n7@manuel.anu.edu.au> titus@coombs.anu.edu.au (titus chiu) writes: >bde@runx.oz.au (Bruce Evans) writes: > >>zip). One advantage of cpio over tar is that it restores directory >>permissions so the default /tmp permissions would get fixed up by a >>/tmp with the correct permissions in another archive. > >that is incorrect i am afraid ;) .. tar will restore permission for >root if the -p flag is used (i am pretty sure gnu tar has this flag) .. Nope. gnu tar-1.10 only restores the permission if the directory doesn't already exist. This seems to be a bug in gnu tar. tar calls mkdir(), which fails when the directory already exists. It then calls make_dirs() which returns early when errno != ENOENT. Apparently too early. The errno from mkdir is EEXISTS. For directories not explicitly mentioned in the tar file, the -p flag causes the umask to be ignored, so the directories get permissions 777. I think ~umask is a better guess for the right permissions in this case. -- Bruce Evans (bde@runx.oz.au)