🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by stuart Thu, 08 Oct 1992 11:55
gnu tar 1.11.1 - owner/group not preserved for directories on extract.
#872
Author: stuart
Date: Thu, 08 Oct 1992 11:55
51 lines
2474 bytes
Utility:	gnu tar 1.11.1
System:		Sequent Symmetry S27
OS: 		dynix 3.0.17.9
Source:		ftp.uu.net:packages/gnu/tar-1.11.1.tar.Z

When extracting files from an archive as root (tar xvpf), the owner
and group are not preserved on directories.  This makes it impossible
to use gnu tar to copy a directory subtree to another location:

	cd /foo ; tar cvf - . | (cd /bar; tar xvpf -)

NOTE:  If the -m flag is included to the tar extract command (tar
xvpmf), owner & group are preserved, but modification times aren't.

Included below is a patch which I think will fix the problem.

-stuart

--
Stuart Pearlman                                 stuart@oasys.dt.navy.mil
Trandes Corporation                             +1 301 459 0200
On-Contract-To: David Taylor Research Center    +1 301 227 1428
---------------------------------------------------------------------------
*** /tmp/,RCSt1013898	Thu Oct  8 15:37:32 1992
--- extract.c	Thu Oct  8 15:33:12 1992
***************
*** 652,657
  
  		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);

--- 652,667 -----
  
  		if (f_modified)
  		  goto set_filestat;
+ 
+                 if (we_are_root || f_do_chown) {
+                         if (chown(skipcrud + current_file_name,
+                                   hstat.st_uid, hstat.st_gid) < 0) {
+                           msg_perror("cannot chown file %s to uid %d gid %d",
+                                      skipcrud + current_file_name,
+                                      hstat.st_uid,hstat.st_gid);
+ 			}
+ 		}
+ 
  		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);
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads