Package: jailtool
Version: 1.1-3

This very usefull tool have a trial bug.

- The script don't handle properly PRUNE and GRAFT statement because the
code use two time the same variables in the same scope... (See patch
below)

- If your jail configuration have the following statement:

PRUNE=/usr/share/timezone
GRAFT=/usr/share/timezone/GMT
GRAFT=/usr/share/timezone/posix/GMT

Rsync will complain because /usr/share/timezone doesn't exists.

There is the patch

--- update-jail-orig    2006-10-10 18:25:57.894197424 +0000
+++ update-jail-new     2006-10-10 19:20:34.041908544 +0000
@@ -19,6 +19,9 @@
 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307  USA
 #
 
+require File::Basename;
+require File::Path;
+
 use strict;
 
 sub collectDirs {
@@ -162,11 +165,11 @@
 FILES: foreach my $file (@files) {
    foreach my $prune (@prune) {
       if (substr($file, 0, length($prune)) eq $prune) {
-         my $graft;
+         my $graft_flag = 0;
          foreach my $graft (@graft) {
-           $graft ||= (substr($file, 0, length($graft)) eq $graft);
+           $graft_flag ||= (substr($file, 0, length($graft)) eq
$graft);
         }
-         next FILES if !$graft;
+         next FILES if !$graft_flag;
       }
    }
    if (-d $file) {
@@ -184,6 +187,15 @@
       if ($simulate) {
          print "SIMUL: syncing $file with $target$file\n";
       } else {
+                my $dir_path = File::Basename::dirname($target .
$file);
+                if ( ! -d $dir_path)
+                {
+                       my @new_dirs = File::Path::mkpath($dir_path, 0,
0755) or 
+                               die "Failed to create path $dir_path";
+                       for my $new_dir (@new_dirs) {
+                               print "Create new directory path
$new_dir\n";
+                       }
+                }
          system "rsync -qlpogtD $file $target$file";
       }
    }
@@ -216,6 +228,15 @@
       if ($simulate) {
          print "SIMUL: syncing $file with $target$file\n";
       } else {
+                my $dir_path = File::Basename::dirname($target .
$file);
+                if ( ! -d $dir_path)
+                {
+                       my @new_dirs = File::Path::mkpath($dir_path, 0,
0755) or 
+                               die "Failed to create path $dir_path";
+                       for my $new_dir (@new_dirs) {
+                               print "Create new directory path
$new_dir\n";
+                       }
+                }
          system "rsync -qlpogtD $file $target$file";
       }
    }


Eric Girard
UNIX Administrator
Gameloft::Global Network Services

Reply via email to