Control: found -1 5.1.1-1 Control: tag -1 + patch Hello,
On Sun, Apr 28, 2019 at 09:08:36PM +0200, andre wrote:
>
> The use of an endhook kills the piping of reprepro list ouput. I tested this
> with Ubuntu 19.04 with following test:
>
> mkdir -p conf
>
> cat >conf/distributions <<DISTRIBUTIONS
> Codename: test
> Components: main
> Architectures: amd64
> DISTRIBUTIONS
>
> reprepro createsymlinks
>
> apt download hello
>
> reprepro includedeb test hello*.deb
>
> # The following command works like expected: The hello package and its
> version is shown on the terminal
> reprepro list test | tee /dev/null
>
> # This works not as expected: Nothing is shown on the terminal
> reprepro --endhook /bin/true list test | tee /dev/null
I noticed the same problem. My repository is a big bigger though and I
get some output, this is incomplete though. Using strace the difference
seems to be
- without a pipe:
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
and then one write to fd 1 for each package.
- with a pipe:
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
and then only writes to fd 1 of size 4096.
So it seems that if there are n chars to be printed, only n & ~4095 make
it to stdout.
The problem already exists in stretch, so adding a found for this
version.
The following patch fixes the problem for me:
diff --git a/main.c b/main.c
index ef8988829aaf..5d413d813027 100644
--- a/main.c
+++ b/main.c
@@ -5186,6 +5186,7 @@ int main(int argc, char *argv[]) {
"There have been errors!\n",
stderr);
}
+ fflush(stdout);
if (endhook != NULL) {
assert (optind > 0);
/* only returns upon error: */
This suggests that execv() (that is called when an endhook is
configured) results in the buffered output to be discarded.
Best regards
Uwe
signature.asc
Description: PGP signature

