pass show --clip bug

Judd Montgomery judd at
Wed Jan 18 17:22:59 UTC 2023

On 1/18/23 11:07, Kjetil Torgrim Homme wrote:
> Den 13/01/2023 04:13, skreiv Judd Montgomery:
>> Hi,
>> 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
> the patch looks good to me, much simpler and safer, and guaranteed to
> not trigger EPIPE.  you should however move your comments from the patch
> into a commit message, I don't think we want history like that in the
> script itself.
Is there a way to commit?  I read the contributing section from I expected whomever was going to commit
it to remove the comments and only add the line with the sed.


This is a very active project with a healthy dose of contributors
<>. The best
way to contribute to the password store is to join the mailing list
<> and send
git formatted patches. You may also join the discussion in |#pass| on


More information about the Password-Store mailing list