Hi,

In OpenBSD's ksh(1), a background process running in a subshell in a
pipeline does not read from standard input.

Try running the following:

        $ ksh -c 'echo foo | { cat & }'

The background cat(1) should read "foo" and write it into standard
output, but it does not.

Compare it with running cat(1) in foreground in the subshell:
(I replaced the "&" with a ";" here).

        $ ksh -c 'echo foo | { cat ; }'
        foo

That first command works fine on bash and ksh93, however:

        $ ksh93 -c 'echo foo | { cat & }'
        foo

        $ bash -c 'echo foo | { cat & }'
        foo

Weird thing is that the next, non-background command can consume the
standard input in ksh(1):

        $ ksh -c 'echo foo | { cat & tr o e ; }'
        fee

Compare it with bash and ksh93:

        $ bash -c 'echo foo | { cat & tr o e ; }'
        foo

        $ ksh93 -c 'echo foo | { cat & tr o e ; }'
        foo

Only OpenBSD's ksh(1) shows this bad behavior.

I'm running OpenBSD 7.3 -current:

        $ uname -a
        OpenBSD sabia 7.3 GENERIC.MP#1268 amd64

Cheers,
Lucas de Sena

Reply via email to