Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] wget download: 'scheme missing' results in empty output file
@ 2016-02-25 13:19 Thomas De Schampheleire
  2016-02-25 15:40 ` Peter Korsgaard
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Thomas De Schampheleire @ 2016-02-25 13:19 UTC (permalink / raw)
  To: buildroot

Hi Yann, all,

When a package does not (by error) define FOO_SITE, and the source
archive is not already present, the wget download helper will be
invoked with as URL /foo-xxx.tar.gz. wget reports 'Scheme missing' and
bails out, but _returns with a successful error code (0)_.

As a result, the download helper happily continues with hash checking
and finally with the atomic mv of the temporary download file (which
has been created but is still empty) to the final output location.

Because as far as the download helper is concerned, everything went
successfully, also the build continues (but obviously fails further
on).

While I think wget should not return 0 on such a problem, I think we
should try and prevent such problems. One way is to expect the
downloaded file size to be greater than 0. If that requirement is not
met, the download helper should bail out.

A patch like the below fixes the problem:

diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper
--- a/support/download/dl-wrapper
+++ b/support/download/dl-wrapper
@@ -87,6 +87,12 @@ main() {
         exit 1
     fi

+    if ! [ -s "${output}" ]; then
+        error "empty download detected\n"
+        rm -rf "${tmpd}"
+        exit 1
+    fi
+
     # cd back to free the temp-dir, so we can remove it later
     cd "${OLDPWD}"



This clearly assumes that no package tries to download a file with size 0.

If you agree with such a change I can send a proper patch.

Thanks,
Thomas

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-07-03  9:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 13:19 [Buildroot] wget download: 'scheme missing' results in empty output file Thomas De Schampheleire
2016-02-25 15:40 ` Peter Korsgaard
2016-02-25 16:05   ` Thomas De Schampheleire
2016-02-25 16:21     ` Peter Korsgaard
2016-02-25 16:07 ` Thomas Petazzoni
2016-02-25 16:13   ` Thomas De Schampheleire
2016-02-25 16:34     ` Peter Korsgaard
2016-02-25 17:01       ` Thomas Petazzoni
2016-02-25 20:32         ` Yann E. MORIN
2016-03-18  9:43           ` Thomas De Schampheleire
2016-07-03  9:54 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox