On Tue, 2014-05-27 at 14:33 +0100, Robie Basak wrote:
> chdist create sid http://ftp.debian.org/debian/ unstable main contrib non-free
> chdist apt-get sid update
> chdist bin2src sid apache2-bin
> 
> Expected output: "apache2" (exit status 0)
> Actual output: "chdist: bad apt-cache : 13" (exit status 1)

The code in question is

    my $pid = open(CACHE, '-|', 'apt-cache', @args);
    if (!defined($pid)) {
        fatal("Couldn't run apt-cache: $!");
    }
    if ($pid) {
        while (<CACHE>) {
            if (m/^Source: (.*)/) {
                $src = $1;
                last;
            }
        }
        close CACHE || fatal("bad apt-cache $!: $?");
        print "$src\n";
    }

The while loop hasn't consumed all of apt-cache's output, so closing the
pipe causes a SIGPIPE (13).

One possible solution would be to replace the loop with something
similar to

        my $found = 0;
        while (<CACHE>) {
            if (m/^Source: (.*)/) {
                $src = $1 if not $found;
                $found = 1;
            }
        }

Regards,

Adam

_______________________________________________
devscripts-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to