Hello,

I am experiencing an unexpected behavior when using "builtin jobs -l". It
seems that it's output fd is not as same as "jobs -l" without the builtin
prefix. So when I piped it into wc, I got different results (as seen in the
code I pasted below).

Bash version: GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
OS: Fedora 25, kernel 4.9.13-200.fc25.x86_64

Buggy behavior:
when we have one or more background processes:
jobs -l | wc        # produces 0 0 0
builtin -l | wc              # produces non-zero non-zero non-zero


I tried to fix the bug, but after I looked at the code, the jobs printing
procedure clearly prints to stdout. So I think it's not a easy work to
track down the bug.


Way to reproduce:

bash-4.3$
bash-4.3$ enable -a | grep jobs
enable jobs
bash-4.3$ cat
^Z
[1]+  Stopped                 cat
bash-4.3$ jobs -l
[1]+ 14030 Stopped                 cat
bash-4.3$ jobs -l | wc
      1       4      39
bash-4.3$ builtin jobs -l | wc
      0       0       0
bash-4.3$ type jobs
jobs is a shell builtin
bash-4.3$ type -a jobs
jobs is a shell builtin
jobs is /usr/bin/jobs
jobs is /bin/jobs
bash-4.3$

Thank you!

Sincerely,
Hengyang
-- 
Hengyang Zhao

Ph.D. Candidate, Electrical Engineering
University of California, Riverside

Reply via email to