Bug Report
Kjetil Torgrim Homme
kjetil.homme at redpill-linpro.com
Sun Jul 5 20:33:39 CEST 2020
On 04/07/2020 01.09, Vasile Martiniuc wrote:
> Good afternoon,
>
> This line is wrong:
> pass="$($GPG -d "${GPG_OPTS[@]}" "$passfile" | tail -n
> +${selected_line} | head -n 1)" || exit $?
>
> "head -n 1" (or "head -1") exits immediately after reading the first
> line. And the "tail" is still writing to the pipe, but there is no
> reader because "head" has exited.
> It send SIGPIPE from the kernel and it exits with the status code 141.
why is this wrong? the exit status of a pipeline is *just* the last
command, and "head -n 1" exits successfully.
another example:
: [kjetilho at ranger ~]; echo foo | false | head -1
: [kjetilho at ranger ~]; echo ${PIPESTATUS[*]}, $?
141 1 0, 0
> You should not use "|| exit". The "${PIPESTATUS[@]}" is "0 141 0" and
> the password is not copied to the clipboard if there are more than one
> line.
> I can't copy passwords if there are more lines (10, 20, 30...).
>
you must be doing something different. have you turned on SIGPIPE
delivering signals? SIGPIPE should be ignored in most circumstances.
--
Kjetil T. Homme
Redpill Linpro - Changing the Game
More information about the Password-Store
mailing list