Subject: bin/3180: tar reports error on setting modes in decimal instead of octal
To: None <gnats-bugs@gnats.netbsd.org>
From: Hubert Feyrer <feyrer@rfhs8012.fh-regensburg.de>
List: netbsd-bugs
Date: 02/01/1997 21:37:20
>Number:         3180
>Category:       bin
>Synopsis:       tar reports error on setting modes in decimal instead of octal
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Feb  1 21:50:04 1997
>Last-Modified:
>Originator:     Hubert Feyrer
>Organization:
Hubert Feyrer <hubert.feyrer@rz.uni-regensburg.de>
>Release:        1.2
>Environment:
	
System: NetBSD miyu 1.2 NetBSD 1.2 (MIYU) #8: Sun Jan 26 20:34:03 MET 1997 feyrer@miyu:/usr/disk1/src12/sys/arch/i386/compile/MIYU i386


>Description:
	tar reports error on setting modes in decimal instead of octal
	while extracting an archive.

	Another bug found while digging the FreeBSD sources. :)


>How-To-Repeat:
>Fix:

diff -crNb /usr/src/gnu/usr.bin/tar/extract.c /usr/homes/feyrer/work/FreeBSD/root/usr.src/tar/extract.c
*** /usr/src/gnu/usr.bin/tar/extract.c	Sun Apr 23 08:36:41 1995
--- /usr/homes/feyrer/work/FreeBSD/root/usr.src/tar/extract.c	Sun Nov  3 15:56:00 1996
***************
*** 557,563 ****
  	  if (chmod (skipcrud + current_file_name,
  		     notumask & (int) hstat.st_mode) < 0)
  	    {
! 	      msg_perror ("cannot change mode of file %s to %ld",
  			  skipcrud + current_file_name,
  			  notumask & (int) hstat.st_mode);
  	    }
--- 550,556 ----
  	  if (chmod (skipcrud + current_file_name,
  		     notumask & (int) hstat.st_mode) < 0)
  	    {
! 	      msg_perror ("cannot change mode of file %s to 0%o",
  			  skipcrud + current_file_name,
  			  notumask & (int) hstat.st_mode);
  	    }
***************
*** 762,768 ****
  	      if (chmod (skipcrud + current_file_name,
  			 notumask & (int) hstat.st_mode) < 0)
  		{
! 		  msg_perror ("cannot change mode of file %s to %ld",
  			      skipcrud + current_file_name,
  			      notumask & (int) hstat.st_mode);
  		}
--- 755,761 ----
  	      if (chmod (skipcrud + current_file_name,
  			 notumask & (int) hstat.st_mode) < 0)
  		{
! 		  msg_perror ("cannot change mode of file %s to 0%o",
  			      skipcrud + current_file_name,
  			      notumask & (int) hstat.st_mode);
  		}
***************
*** 940,946 ****
  	  if (chmod (saved_dir_info_head->path,
  		     notumask & saved_dir_info_head->mode) < 0)
  	    {
! 	      msg_perror ("cannot change mode of file %s to %ld",
  			  saved_dir_info_head->path,
  			  notumask & saved_dir_info_head->mode);
  	    }
--- 933,939 ----
  	  if (chmod (saved_dir_info_head->path,
  		     notumask & saved_dir_info_head->mode) < 0)
  	    {
! 	      msg_perror ("cannot change mode of file %s to 0%o",
  			  saved_dir_info_head->path,
  			  notumask & saved_dir_info_head->mode);
  	    }

>Audit-Trail:
>Unformatted: