[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#970678: Network preseeding using http is broken



Philip Hands @ 2020-09-21 (Monday), 15:30 (+0200)
Martin Samuelsson <debianbts2020@nurysto.netizen.se> writes:

Just to be clear on this point, are you saying [...]

I'm saying there is no /dev/fd/ at all on current daily debian-installer images and hasn't been since at least 20200818 (which was the oldest one I could try with current kernel modules).

Missing fd:s is the root cause, and a different issue which I hope someone else is addressing in case it is a bug. (Nothing else in d-i failed for me due to it.)

To illustrate this, here's some output from busybox shell, running on my
laptop:

Yet those examples are not from the context of a recent debian-installer nightly image, right?
If you noticed that it's not there when e.g. simply listing the contents
of /dev/fd then that's normal AFAIK.

The issue I reported is that wget404() is unnecessarily complex and fragile, for no reasonable reason. (You've stated so yourself in the README.wget404)

A suggested fix for /usr/lib/fetch-url/http looks as below:

--- http.orig	2020-09-21 17:21:24.159480072 +0200
+++ http.simplified	2020-09-21 17:21:03.951356698 +0200
@@ -14,10 +14,10 @@

		local RETVAL=$( {
			echo 1
-			wget "$@" 2>&1 >&3 && echo %OK%
+			wget "$@" 2>&1 && echo %OK%
			echo %EOF%
-			} | ( sed -ne '1{h;d};/'"$file_not_found_pattern"'/{p;s/.*/4/;h;d};/^%OK%$/{s/.*/0/;h;d};$!p;$x;$w /dev/fd/4' >&2 ) 4>&1
-		) 3>&1
+			} | ( sed -ne '1{h;d};/'"$file_not_found_pattern"'/{p;s/.*/4/;h;d};/^%OK%$/{s/.*/0/;h;d};$!p;$x;$p '>&2 )
+ ) return $RETVAL
	}

I just tried patching as above at the first of the interactive debug prompts when setting the DEBUG bootflag high. Installation succeeded, and fetch-url still returns 0 on success, 1 on general failure and 4 on http not found. The only difference is that any output from wget is discarded already inside wget404() rather than by the call to wget404().

It seems me mentioning the issue on irc made you fix typos in the README. The preservation of wget's stdout and stderr looks fenomenal, but it fills no practical purpose. Please consider killing your darling. Simple code is beautiful and robust code.
--
/Martin


Reply to: