Package: devscripts
Version: 2.25.30
Severity: normal

Hi,

While developing https://orig-check.debian.net/, I noticed that dget
exits with exit code 0 even if the download of one of the files pointed
by the dsc fails, but not the download of the dsc itself.

On a virtual machine with low diskspace available:

root@dget-test:~# dget --download-only --allow-unauthenticated 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3-1.dsc
dget: retrieving 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3-1.dsc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 37799 100 37799   0     0 512674     0  --:--:-- --:--:-- --:--:-- 517794
dget: retrieving 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3.orig-helpcontent2.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 57862k 100 57862k   0     0 81594k     0  --:--:-- --:--:-- --:--:-- 81611k
dget: retrieving 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3.orig-translations.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
 43 222.6M  43 99474k   0     0 83411k     0   0:00:02  0:00:01  0:00:01 83451k
curl: (23) Failure writing output to destination, passed 16357 returned 1792
dget: curl libreoffice_25.8.3.orig-translations.tar.xz 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3.orig-translations.tar.xz
 failed
E: You must put some 'deb-src' URIs in your sources.list
root@dget-test:~# echo $?
0

Not all failures are affected, e.g. with a non-existing dsc:

root@dget-test:~# dget --download-only --allow-unauthenticated 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3-12.dsc
dget: retrieving 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3-12.dsc
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0   0     0   0     0     0     0  --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
dget: curl libreoffice_25.8.3-12.dsc 
https://deb.debian.org/debian/pool/main/libr/libreoffice/libreoffice_25.8.3-12.dsc
 failed
root@dget-test:~# echo $?
1

Looking at the code, what happens is:

parse_file() parses the dsc (which is downloaded OK), then calls
get_file() for each file.

get_file() calls wget().

wget() fails, but returns 0, because of
https://salsa.debian.org/debian/devscripts/-/blame/main/scripts/dget.pl?ref_type=heads#L145
(curl's exit code is 23 in that case)

Then the file doesn't exist, so dget tries apt-get source (hence the
message about deb-src URLs), that fails, and get_file() returns 0:
https://salsa.debian.org/debian/devscripts/-/blame/main/scripts/dget.pl?ref_type=heads#L223

But that 0 return value is not considered by parse_file() nor get_file().

A possible fix, but I'm not sure I got everything right:

--- /usr/bin/dget.orig  2025-12-16 10:49:04.942343631 +0000
+++ /usr/bin/dget       2025-12-16 10:50:58.839938116 +0000
@@ -244,7 +244,7 @@
     $seen{$file} = 1;
 
     if ($file =~ /\.(?:changes|dsc)$/) {
-        parse_file($dir, $file);
+        parse_file($dir, $file) or return 0;
     }
     if ($file =~ /\.dsc$/) {
         $found_dsc = $file;
@@ -263,10 +263,11 @@
             my ($_sum, $_file) = ($1, $2);
             $_file !~ m,[/\x00],
               or die "File name contains invalid characters: $_file";
-            get_file($dir, $_file, $_sum) or return;
+            get_file($dir, $_file, $_sum) or return 0;
         }
     }
     close $fh;
+    return 1;
 }
 
 sub quote_version {


Lucas

Reply via email to