Просмотр исходного кода

Apply patch, to handle missing infodir.bak, and empty files.

Adam Heath лет назад: 23
Родитель
Сommit
60b296589d
3 измененных файлов с 21 добавлено и 2 удалено
  1. 5 0
      ChangeLog
  2. 3 0
      debian/changelog
  3. 13 2
      scripts/install-info.pl

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+Sat Sep 13 14:24:14 CDT 2003 Adam Heath <doogie@debian.org>
+
+  * scripts/install-info.pl: Apply patch, to handle missing infodir.bak,
+    and empty files.
+
 Sat Sep 13 14:21:13 CDT 2003 Adam Heath <doogie@debian.org>
 
   * config.sub, config.guess: Updated

+ 3 - 0
debian/changelog

@@ -4,6 +4,9 @@ dpkg (1.10.11) unstable; urgency=low
   * Add build-depends on sgml-base, and increase gettext build-depends to
     0.12.1-3.
   * Updated config.sub and config.guess in cvs.
+  * Frank Lichtenheld <frank@lichtenheld.de>:
+    Apply patch, to handle missing infodir.bak, and empty files.  Closes:
+    #196361
 
  -- Wichert Akkerman <debian@extern.wiggy.net>  UNRELEASED
 

+ 13 - 2
scripts/install-info.pl

@@ -31,6 +31,7 @@ $infodir='/usr/share/info';
 $maxwidth=79;
 $Text::Wrap::columns=$maxwidth;
 $backup='/var/backups/infodir.bak';
+$default='/usr/share/base-files/info.dir';
 
 $menuentry="";
 $description="";
@@ -253,9 +254,19 @@ if (!$nowrite && ( ! -e "$infodir/dir" || ! -s "$infodir/dir" )) {
 	    exit 1;
 	}
     } else {
-	print STDERR "$name: no backup file $backup available, giving up.\n";
+        if (-r $default) {
+	    print STDERR "$name: no backup file $backup available, retrieving default file.\n";
+	    
+	    if (system("cp $default $infodir/dir")) {
+		print STDERR "$name: copying $default to $infodir/dir failed, giving up: $!\n";
 	exit 1;
     }
+	} else {
+	    print STDERR "$name: no backup file $backup available.\n";
+	    print STDERR "$name: no default file $default available, giving up.\n";
+	    exit 1;
+	}
+    }
 }
 
 if (!$nowrite && !link("$infodir/dir","$infodir/dir.lock")) {
@@ -267,7 +278,7 @@ open(OLD,"$infodir/dir") || &ulquit("open $infodir/dir: $!");
 @work= <OLD>;
 eof(OLD) || &ulquit("read $infodir/dir: $!");
 close(OLD) || &ulquit("close $infodir/dir after read: $!");
-while ($work[$#work] !~ m/\S/) { $#work--; }
+while ($work[$#work] !~ m/\S/) { $#work--; last unless $#work; }
 
 while (@work) {
     $_= shift(@work);