pass show --clip bug

Judd Montgomery judd at
Fri Jan 13 03:13:03 UTC 2023


I have a secret that is over 1000 lines long and each line is on average
24 characters.  I noticed that the pass show -c[line-number] option only
works when trying to clip lines numbers greater than 850 or so.  Any
line number less than this fails with a return code of 141.  I suspect
this will vary depending on Linux kernel versions, tuning and buffer
sizes and I will try to explain why.

The error code 141 that gets returned in this case is pipefail. At the
top of the pass script is a "set -o pipefail" and that causes the script
to exit in this case.  This happens because the output of a tail command
is piped into a head -n 1 which closes the read pipe as soon as it reads
one line.  If the tail command is not done writing then it fails with a
pipefail (141) because its writing to a closed pipe.  Normally this is
not noticed or unexpected behavior.  When I show/clip lines near the end
of the file it succeeds because tail is done writing.  If I show/clip
lines early in the file then the tail command gets its pipe "rudely"
shutdown ;-)

I am attaching a patch that I tested.  I didn't write a test.

Here is an explanation I initially found


-------------- next part --------------
A non-text attachment was scrubbed...
Type: text/x-patch
Size: 1154 bytes
Desc: not available
URL: <>

More information about the Password-Store mailing list