Article View: linux.debian.bugs.dist
Article #7539Bug#1156399: wget: --input-file from stdin may break URLs in the middle of a line
From: David Fifield
Date: Sat, 05 Dec 2026 05:10
Date: Sat, 05 Dec 2026 05:10
101 lines
7988 bytes
7988 bytes
Package: wget
Version: 1.25.0-2
Severity: normal
X-Debbugs-Cc: david@bamsoftware.com
When wget reads a list of input URLs from a pipe on stdin with
`--input-file=-`, it may break URLs in the middle of a line depending on
the speed and buffering of the input pipe. If the program writing into
wget's standard input writes 1024 bytes, say, wget may treat the partial
line leading up to the 1024th byte as a complete URL, even though more
data is forthcoming. The remainder of the URL after the 1024th byte,
when it is written, is itself treated as a complete URL.
Here is a reproduction recipe. It uses perl to write a file into wget's
stdin in chunks, with a delay between each chunk.
Write these contents to a file called input.txt:
https://www.debian.org/index.html?param=11111111111111111111111111111111
https://www.debian.org/index.html?param=22222222222222222222222222222222
https://www.debian.org/index.html?param=33333333333333333333333333333333
https://www.debian.org/index.html?param=44444444444444444444444444444444
https://www.debian.org/index.html?param=55555555555555555555555555555555
https://www.debian.org/index.html?param=66666666666666666666666666666666
https://www.debian.org/index.html?param=77777777777777777777777777777777
If you run wget to read the input from the file input.txt, it works as
expected, saving 7 files:
$ wget --no-verbose --directory-prefix=file --input-file input.txt
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=11111111111111111111111111111111 [15862/15862] -> "file/index.html?param=11111111111111111111111111111111" [1]
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=22222222222222222222222222222222 [15862/15862] -> "file/index.html?param=22222222222222222222222222222222" [1]
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=33333333333333333333333333333333 [15862/15862] -> "file/index.html?param=33333333333333333333333333333333" [1]
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=44444444444444444444444444444444 [15862/15862] -> "file/index.html?param=44444444444444444444444444444444" [1]
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=55555555555555555555555555555555 [15862/15862] -> "file/index.html?param=55555555555555555555555555555555" [1]
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=66666666666666666666666666666666 [15862/15862] -> "file/index.html?param=66666666666666666666666666666666" [1]
2026-12-04 23:42:04 URL:https://www.debian.org/index.html?param=77777777777777777777777777777777 [15862/15862] -> "file/index.html?param=77777777777777777777777777777777" [1]
FINISHED --2026-12-04 23:42:04--
Total wall clock time: 0.9s
Downloaded: 7 files, 108K in 0.06s (1.70 MB/s)
Now pipe input.txt through a program that buffers it in 192-byte chunks.
The 3rd and 6th lines coincide with the chunk boundaries and each get
split into two URLs:
$ perl -e '$| = 1; my $buf; do { read(STDIN, $buf, 192); print($buf); sleep 1; } while ($buf);' < input.txt | wget --no-verbose --directory-prefix=pipe --input-file=-
2026-12-04 23:40:51 URL:https://www.debian.org/index.html?param=11111111111111111111111111111111 [15862/15862] -> "pipe/index.html?param=11111111111111111111111111111111" [1]
2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=22222222222222222222222222222222 [15862/15862] -> "pipe/index.html?param=22222222222222222222222222222222" [1]
2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=333333 [15862/15862] -> "pipe/index.html?param=333333" [1]
Prepended http:// to '33333333333333333333333333'
wget: unable to resolve host address β33333333333333333333333333β
2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=44444444444444444444444444444444 [15862/15862] -> "pipe/index.html?param=44444444444444444444444444444444" [1]
2026-12-04 23:40:52 URL:https://www.debian.org/index.html?param=55555555555555555555555555555555 [15862/15862] -> "pipe/index.html?param=55555555555555555555555555555555" [1]
wget: unable to resolve host address βwww.debian.β
Prepended http:// to 'org/index.html?param=66666666666666666666666666666666'
wget: unable to resolve host address βorgβ
2026-12-04 23:40:53 URL:https://www.debian.org/index.html?param=77777777777777777777777777777777 [15862/15862] -> "pipe/index.html?param=77777777777777777777777777777777" [1]
FINISHED --2026-12-04 23:40:55--
Total wall clock time: 4.0s
Downloaded: 6 files, 93K in 0.07s (1.35 MB/s)
If you want to know what I was doing when I ran into this problem, I was
running a command that uses wget to fetch a JSON file, filters the JSON
with jq to output a list of URLs, and piping the list into another
instance of wget to download the files.
https://gitlab.torproject.org/dcf/snowflake-graphs/-/blob/f702555796b6372c2df3a18af12a259d9db1148b/README.md#L83
wget -O - https://collector.torproject.org/index/index.json | jq -r '.directories[]|select(.path == "archive").directories[]|select(.path == "snowflakes").files[]|("https://collector.torproject.org/archive/snowflakes/"+.path)' | wget --input-file=- --timestamping --directory-prefix=./descriptors/
I found that the URL spanning the 4096-byte boundary was getting split:
https://collector.torproject.org/archive/bridge-descriptors/extra-in
fos/bridge-extra-infos-2020-03.tar.xz
-- System Information:
Debian Release: 13.8
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.12.118+deb13-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages wget depends on:
ii libc6 2.41-12+deb13u5
ii libgnutls30t64 3.8.9-3+deb13u4
ii libidn2-0 2.3.8-2
ii libnettle8t64 3.10.1-1
ii libpcre2-8-0 10.46-1~deb13u3
ii libpsl5t64 0.21.2-1.1+b1
ii libuuid1 2.41.5-0+deb13u1
ii zlib1g 1:1.3.dfsg+really1.3.1-1+deb13u1
Versions of packages wget recommends:
ii ca-certificates 20250419+deb13u1
wget suggests no packages.
-- no debconf information
Technical Details
Message-ID:
<O6Qc2-g4vL-5@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news-ams.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news-ams.pugleaf.net!news.tcpreset.net!newsfeed.bofh.team!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod From: David Fifield <david@bamsoftware.com> Newsgroups: linux.debian.bugs.dist Subject: Bug#1156399: wget: --input-file from stdin may break URLs in the middle of a line Date: Sat, 05 Dec 2026 06:10:02 +0100 Message-ID: <O6Qc2-g4vL-5@gated-at.bofh.it> X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Sat Dec 5 05:03:10 2026 Old-Return-Path: <debbugs@buxtehude.debian.org> X-Spam-Flag: NO X-Spam-Score: -1.451 Reply-To: David Fifield <david@bamsoftware.com>, 1156399@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: david@bamsoftware.com, noel@debian.org X-Debian-Pr-Message: report 1156399 X-Debian-Pr-Package: wget X-Debian-Pr-Source: wget X-Mailer: reportbug 13.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Greylist: delayed 518 seconds by postgrey-1.37 at buxtehude; Sat, 05 Dec 2026 04:59:36 UTC X-Debian-Message: from BTS X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2007074 List-ID: <debian-bugs-dist.lists.debian.org> List-URL: <https://lists.debian.org/debian-bugs-dist/> Approved: robomod@news.nic.it Lines: 101 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Sat, 5 Dec 2026 04:50:53 +0000 X-Original-Message-ID: <179644611187.17835.18084789200276451305.reportbug@happy>