🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #28

Bug in GNU tar 1.11.1

#28
From: Masatoshi Watanabe
Date: Fri, 30 Oct 1992 12:01
46 lines
1886 bytes
I found a problem in GNU tar 1.11.1. As shown in following log, owner
of the extracted directory is not same with original one.  (izanami%
is a prompt.)


    izanami% mkdir test
    izanami% ls -lg
    total 1
    drwxr-xr-x  2 watanabe staff         512 Oct 30 20:15 test
    izanami% tar cvf hoe.tar test
    test/
    izanami% rmdir test
    izanami% su
    Password:
    izanami# tar xvf hoe.tar
    test/
    Reading test
    izanami# ls -lg
    total 11
    -rw-r--r--  1 watanabe staff       10240 Oct 30 20:16 hoe.tar
    drwxr-xr-x  2 root     wheel         512 Oct 30 20:15 test


This problem does not happen when using tar with -m option.
I attempted following patch to avoid this problem.


*** extract.c.orig	Wed Sep 16 08:54:58 1992
--- extract.c	Fri Oct 30 16:40:03 1992
***************
*** 652,657 ****
--- 652,665 ----
  
  		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);
Technical Details
Message-ID: <9210301201.AA28503@izanami.material.tohoku.ac.jp>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!izanami.material.tohoku.ac.jp!watanabe

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!izanami.material.tohoku.ac.jp!watanabe
From: watanabe@izanami.material.tohoku.ac.jp (Masatoshi Watanabe)
Subject: Bug in GNU tar 1.11.1
Message-ID: <9210301201.AA28503@izanami.material.tohoku.ac.jp>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 30 Oct 1992 12:01:53 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 48