Article View: gnu.utils.bug
Article #1291Re: tar-1.11.1: directory owner/modes don't get restored
From: Jurgen Botz
Date: Sun, 10 Jan 1993 15:42
Date: Sun, 10 Jan 1993 15:42
53 lines
2872 bytes
2872 bytes
In article <9301041508.AA27693@orixa.mtholyoke.edu> I wrote:
>I'm using tar-1.11.1 on a DECstation under Ultrix 4.2 and I'm finding
>that directory ownerships/modes don't get restored (i.e. when running
>as root and with -p). Instead directories are created with owner root
>and mode 700. Files are restored properly.
Included is a fix for this problem. The interesting thing was that
directory ownerships /were/ restored properly when the '-m' flag
(don't restore modification times) was given. The reason is that
with the -m flag the code that set owner, modes, and modification
times was executed and modes/times were not saved for restoring after
the contents of the directory were restored. Without the -m flag
the owner/times/mode code was /not/ executed when directory was
created, but the modes/times but no ownership were saved to be set
after the dir's contents were restored. With my fix ownership is
set correctly, but I'm not sure about whether the -m flag still
behaves as intended, because I don't really understand /exactly/
how it was intended to work. There is some confusion in the overall
structure of the extract.c code with regard to when what should be
done. I think to really fix this code the mega-switch in
extract_archive() needs to be decomposed some more. Anyway, for
most people this patch is probably a sufficient "fix".
- Jurgen Botz
Note: if you applied Jonathan Kamen's recent fix to check the
malloc return values, change the references to malloc in this
fragment to 'ck_malloc' before applying this patch.
---- snip -----------------------------------------------------
--- extract.c.orig Sun Jan 10 17:10:13 1993
+++ extract.c Sun Jan 10 17:36:31 1993
@@ -649,9 +649,6 @@
msg("Added write and execute permission to directory %s",
skipcrud+current_file_name);
}
-
- if (f_modified)
- goto set_filestat;
tmp = (struct saved_dir_info *) malloc (sizeof (struct saved_dir_info));
tmp->path = malloc (strlen (skipcrud + current_file_name) + 1);
strcpy (tmp->path, skipcrud + current_file_name);
@@ -660,6 +657,7 @@
tmp->mtime = hstat.st_mtime;
tmp->next = saved_dir_info_head;
saved_dir_info_head = tmp;
+ goto set_filestat;
case LF_VOLHDR:
if(f_verbose) {
printf("Reading %s\n", current_file_name);
--
Jurgen Botz, jbotz@mtholyoke.edu
Northampton, MA, USA
Technical Details
Message-ID:
<1iqjakINN4hb@slab.mtholyoke.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mtholyoke.EDU!jbotzReferences:
<9301041508.AA27693@orixa.mtholyoke.edu>Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!mtholyoke.EDU!jbotz From: jbotz@mtholyoke.EDU (Jurgen Botz) Subject: Re: tar-1.11.1: directory owner/modes don't get restored Message-ID: <1iqjakINN4hb@slab.mtholyoke.edu> Sender: gnulists@ai.mit.edu Organization: Mount Holyoke College References: <9301041508.AA27693@orixa.mtholyoke.edu> Distribution: gnu Date: Sun, 10 Jan 1993 15:42:44 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 54