From 60b296589d6784333744503f409b3569a2f7ea95 Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Sat, 13 Sep 2003 19:25:36 +0000 Subject: [PATCH] Apply patch, to handle missing infodir.bak, and empty files. --- ChangeLog | 5 +++++ debian/changelog | 3 +++ scripts/install-info.pl | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4fc00a4c..06819686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Sep 13 14:24:14 CDT 2003 Adam Heath + + * scripts/install-info.pl: Apply patch, to handle missing infodir.bak, + and empty files. + Sat Sep 13 14:21:13 CDT 2003 Adam Heath * config.sub, config.guess: Updated diff --git a/debian/changelog b/debian/changelog index 0c82b2c9..aa9788a6 100644 --- a/debian/changelog +++ b/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 : + Apply patch, to handle missing infodir.bak, and empty files. Closes: + #196361 -- Wichert Akkerman UNRELEASED diff --git a/scripts/install-info.pl b/scripts/install-info.pl index eecd2625..8442cd02 100755 --- a/scripts/install-info.pl +++ b/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= ; 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); -- 2.39.5