[Adduser-devel] Bug#451321: adduser: deluser should not rewrite	backup files
    Kris Kvilekval 
    kris at cs.ucsb.edu
       
    Wed Nov 14 23:38:09 UTC 2007
    
    
  
Package: adduser
Version: 3.105
Severity: minor
Tags: patch
The original backup code in deluser first writes the tar file, and then compresses it.
This patch simply uses some gnu tar options (already required) to accomplish
the same.   This is useful when backup up over NFS.
*** deluser.orig	2007-11-14 15:29:19.000000000 -0800
--- deluser	2007-11-14 15:29:27.000000000 -0800
***************
*** 300,317 ****
  	  print $filesfile join("\n", at files);
  	  $filesfile->close();
           my $tar = &which('tar');
! 	  &systemcall($tar, "-cf", $backup_name, "--files-from", $filesfilename);
! 	  chmod 0600, $backup_name;
!          my $rootid = 0;
! 	  chown $rootid, $rootid, $backup_name;
! 	  unlink($filesfilename);
           my $bzip2 = &which('bzip2', 1);
           my $gzip = &which('gzip', 1);
  	  if($bzip2) {
! 	      systemcall($bzip2, $backup_name);
  	  } elsif($gzip) {
! 	      systemcall($gzip, "--best", $backup_name);
  	  }
        }
  
        if(@files || @dirs) {
--- 300,322 ----
  	  print $filesfile join("\n", at files);
  	  $filesfile->close();
           my $tar = &which('tar');
!         
!          my $ext = "";
!          my $options = "";
           my $bzip2 = &which('bzip2', 1);
           my $gzip = &which('gzip', 1);
  	  if($bzip2) {
! 	      $options .= "--bzip2";
!               $ext = ".bz2";
  	  } elsif($gzip) {
! 	      $options .= "--gzip";
!               $ext = ".gz";
  	  }
+ 	  &systemcall($tar, "-c" , $options, "-f", $backup_name.$ext, "--files-from", $filesfilename);
+ 	  chmod 600, $backup_name;
+          my $rootid = 0;
+ 	  chown $rootid, $rootid, $backup_name.$ext;
+ 	  unlink($filesfilename);
        }
  
        if(@files || @dirs) {
-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages adduser depends on:
ii  debconf [debconf-2.0]       1.5.11       Debian configuration management sy
ii  passwd                      1:4.0.18.1-7 change and administer password and
ii  perl-base                   5.8.8-7      The Pathologically Eclectic Rubbis
adduser recommends no packages.
-- debconf information:
* adduser/homedir-permission: true
    
    
More information about the Adduser-devel
mailing list