🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Nigel Metheringham Thu, 05 Nov 1992 11:29
Directory extract ownership bug in gnu tar 1.11.1
#1022
Author: Nigel Metheringham
Date: Thu, 05 Nov 1992 11:29
41 lines
2088 bytes
Gnu tar 1.11.1 does not set the ownership of extracted directories - no
matter whether you are root or how many preserve type options you add.

The included patch fixes this, but is just a very fast workround - ie I
haven't checked it in detail to make sure it doesn't break anything
else.  The code to do the chown is (obviously) stolen from slightly
further up the file (in the file extract code!).

	Nigel.

--- extract.c~	Wed Sep 16 00:54:58 1992
+++ extract.c	Thu Nov  5 11:21:34 1992
@@ -649,6 +649,21 @@
 			msg("Added write and execute permission to directory %s",
 			  skipcrud+current_file_name);
 		}
+		/*
+		 * If we are root, set the owner and group of the extracted
+		 * dir.  This does what is wanted both on real Unix and on
+		 * System V.  If we are running as a user, we extract as that
+		 * user; if running as root, we extract as the original owner.
+		 * *** Missing on distribution 1.11.1 version - added by nigelm.
+		 */
+		if (we_are_root || f_do_chown) {
+			if (chown(skipcrud + current_file_name,
+				   hstat.st_uid, hstat.st_gid) < 0) {
+			   msg_perror("cannot chown dir %s to uid %d gid %d",
+				      skipcrud + current_file_name,
+				      hstat.st_uid,hstat.st_gid);
+			}
+		}
 
 		if (f_modified)
 		  goto set_filestat;


 -- 
# Nigel Metheringham         #  EMail: nigelm@ohm.york.ac.uk #
# System Administrator       #  Phone: +44 904 432374        #
# Department of Electronics  #  Fax:   +44 904 432335        #
#     University of York, Heslington, York, UK, YO1 5DD      #
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