Checking successful downloads broken
Package: debootstrap
Version: 0.1.16.4
Severity: serious
Tags: patch
Careful with those followups.
On Sun, Mar 03, 2002 at 06:14:37PM -0700, Chris Tillman wrote:
> > Debootstrap itself probably won't be able to spot failed downloads
> > of the Release file because its error checking relies on $PIPESTATUS
> > which ash doesn't seem to support.
> No _that_ sounds like a root cause.
It does indeed. The fix is to make sure pkgdetails' exit code reflects
whether the download succeeded or not. Doing:
diff -urb debootstrap-0.1.16/functions debootstrap-0.1.16.new/functions
--- debootstrap-0.1.16/functions Sun Jan 20 20:29:12 2002
+++ debootstrap-0.1.16.new/functions Mon Mar 4 16:46:00 2002
@@ -46,7 +46,7 @@
local ret=0
if [ "$USE_BOOTFLOPPIES_INTERACTION" -a "$PROGRESS_NEXT" ]; then
wget "$@" 2>&1 >/dev/null | $PKGDETAILS "WGET%" $PROGRESS_NOW $PROGRESS_NEXT $PROGRESS_END "$PROGRESS_WHAT" >&3
- ret=${PIPESTATUS:-0}
+ ret=$?
else
wget -q "$@"
ret=$?
diff -urb debootstrap-0.1.16/pkgdetails.c debootstrap-0.1.16.new/pkgdetails.c
--- debootstrap-0.1.16/pkgdetails.c Sun Jan 20 20:25:11 2002
+++ debootstrap-0.1.16.new/pkgdetails.c Mon Mar 4 16:46:10 2002
@@ -56,9 +56,10 @@
exit(0);
}
-static void dotranslatewgetpercent(int low, int high, int end, char *str) {
+static int dotranslatewgetpercent(int low, int high, int end, char *str) {
int ch;
int val;
+ int lastval = 0;
/* print out anything that looks like a % on its own line, appropriately
* scaled */
@@ -70,10 +71,12 @@
} else if (ch == '%') {
float f = (float) val / 100.0 * (high - low) + low;
printf("P: %d %d %s\n", (int) f, end, str);
+ lastval = val;
} else {
val = 0;
}
}
+ return lastval == 100;
}
int main(int argc, char *argv[]) {
@@ -81,9 +84,13 @@
dopkgmirrorpkgs(argc, argv);
exit(0);
} else if (argc == 6 && strcmp(argv[1], "WGET%") == 0) {
- dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]),
- atoi(argv[4]), argv[5]);
+ if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]),
+ atoi(argv[4]), argv[5]))
+ {
exit(0);
+ } else {
+ exit(1);
+ }
} else {
fprintf(stderr, "usage: %s pkg mirror packages_file\n", argv[0]);
fprintf(stderr, " or: %s WGET%% low high end reason\n", argv[0]);
Seems like it should work.
Cheers,
aj
--
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
We came. We Saw. We Conferenced. http://linux.conf.au/
``Debian: giving you the power to shoot yourself in each
toe individually.'' -- with kudos to Greg Lehey
Reply to: