Article View: gnu.utils.bug
Article #1022Directory extract ownership bug in gnu tar 1.11.1
From: Nigel Metheringham
Date: Thu, 05 Nov 1992 11:29
Date: Thu, 05 Nov 1992 11:29
41 lines
2088 bytes
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 #
Technical Details
Message-ID:
<m0mn5PO-000F0hC@glenlivet.ohm.york.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!hal.com!olivea!charnel!rat!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ohm.york.ac.UK!nigelmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!hal.com!olivea!charnel!rat!usc!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ohm.york.ac.UK!nigelm From: nigelm@ohm.york.ac.UK (Nigel Metheringham) Newsgroups: gnu.utils.bug Subject: Directory extract ownership bug in gnu tar 1.11.1 Message-ID: <m0mn5PO-000F0hC@glenlivet.ohm.york.ac.uk> Date: 5 Nov 92 11:29:53 GMT Sender: gnulists@ai.mit.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 41 Approved: bug-gnu-utils@prep.ai.mit.edu