Control: user [email protected]
Control: usertags -1 rsn
Andrej Shadura writes ("Bug#940588: git-debpush: pipefail in
get_file_from_ref"):
> Package: git-debpush
> Version: 9.9
> Severity: important
...
> 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:
>
> ++ get_file_from_ref debian/source/format
> ++ local path=debian/source/format
> ++ git ls-tree --name-only -r refs/heads/debian/buster-security
> ++ grep -Eq '^debian/source/format$'
> ++ echo @@@@ 141
>
> It helped when I replaced it with a redirect:
>
> if git ls-tree --name-only -r "$branch" \
> | grep -E "^$path$" >/dev/null; then
> git cat-file blob $branch:$path
> fi
>
> ++ local path=debian/source/format
> ++ git ls-tree --name-only -r refs/heads/debian/buster-security
> ++ grep -E '^debian/source/format$'
> ++ echo @@@@ 0
I agree with the suggestion to redirect to >/dev/null
Background from irc:
11:37 <Diziet> The thing with pipefail and SIGPIPE is very annoying.
11:37 <Diziet> IMO this is a bug in set -o pipefail
11:38 <Diziet> if ( git ls-tree --name-only -r "$branch" || test $? = 141 ) |
...
11:38 <Diziet> What even weirder this is all in an if
11:39 <andrewsh> I’d just >/dev/null tbh
11:39 <Diziet> http://paste.debian.net/1101208/#
ie:
mariner:~> bash -xec 'set -o pipefail; if yes | head -1 ; then id; fi'
+ set -o pipefail
+ yes
+ head -1
y
mariner:~>
11:39 <andrewsh> that’s more readable to me at least
11:40 <Diziet> I guess the performance is not really a consideration since it's
O(n) either way
11:40 <Diziet> (both because the worst case is O(n) and because the rest of it
is O(n))
--
Ian Jackson <[email protected]> These opinions are my own.
If I emailed you from an address @fyvzl.net or @evade.org.uk, that is
a private address which bypasses my fierce spamfilter.