Hello, On Tue 17 Sep 2019 at 12:24PM +02, Andrej Shadura wrote:
> In line 61, grep -Eq may cause a pipefail if grep exits before git > ls-tree concludes. With a debug print for $? I can see this: Here's a patch implementing the fix. Thank you for the report! -- Sean Whitton
From 446b5b8c9c8179cd6f516fc5460ba70147c94e61 Mon Sep 17 00:00:00 2001 From: Sean Whitton <spwhit...@spwhitton.name> Date: Sat, 19 Oct 2019 10:33:10 -0700 Subject: [PATCH] git-debpush: avoid a pipefail problem in get_file_from_ref `grep -q` exits as soon as it finds a matching line, potentially sending a SIGPIPE to git-ls-tree. We have pipefail turned on, so that can make the whole pipeline exit nonzero, which is wrong when grep did in fact find a match. This solution is more readable than disabling pipefail just for this line (as is done elsewhere in git-debpush). Reported-by: Andrej Shadura <andre...@debian.org> Signed-off-by: Sean Whitton <spwhit...@spwhitton.name> --- git-debpush | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-debpush b/git-debpush index c3b067dc..2790560c 100755 --- a/git-debpush +++ b/git-debpush @@ -59,8 +59,10 @@ badusage () { get_file_from_ref () { local path=$1 + # redirect to /dev/null instead of using `grep -Eq` to avoid grep + # SIGPIPEing git-ls-tree if git ls-tree --name-only -r "$branch" \ - | grep -Eq "^$path$"; then + | grep -E "^$path$" >/dev/null; then git cat-file blob $branch:$path fi } -- 2.20.1
signature.asc
Description: PGP signature