Tiny Core Extensions > TCE Bugs

[Solved] in havoc terminal emulator: yes causes broken pipes

<< < (6/8) > >>

Rich:
Hi GNUser
I see you added an example to your post.

This is interesting:

--- Code: ---tc@E310:~$ trap '' SIGPIPE  # Disable handler
tc@E310:~$ echo "this is a test" >test.txt
tc@E310:~$ busybox yes "password" | bcrypt test.txt
Encryption key:
Again:
^Ctc@E310:~$ # busybox yes enters infinite loop, Ctrl-C breaks us out.
tc@E310:~$
tc@E310:~$ echo "this is a test" >test.txt
tc@E310:~$ yes "password" | bcrypt test.txt
Encryption key:
Again:
yes: standard output: Broken pipe
tc@E310:~$ # GNU yes works.
tc@E310:~$
tc@E310:~$ trap - SIGPIPE  # Enable handler
tc@E310:~$ echo "this is a test" >test.txt
tc@E310:~$ busybox yes "password" | bcrypt test.txt
Encryption key:
Again:
tc@E310:~$ # busybox yes works.
tc@E310:~$
tc@E310:~$ echo "this is a test" >test.txt
tc@E310:~$ yes "password" | bcrypt test.txt
Encryption key:
Again:
tc@E310:~$ # GNU yes still works.
--- End code ---

This seems to suggest there may be a bug in  busybox yes  when
there is no signal handler for  SIGPIPE.

If you use  GNU yes , does the problem go away?

GNUser:
Hi Rich.

--- Quote from: Rich on October 28, 2023, 09:13:53 PM ---If you use  GNU yes , does the problem go away?

--- End quote ---
No.

I think I figured it out. Juanito sees this error in weston-terminal because that terminal ignores SIGPIPE (see here). In my case, I am seeing the error in havoc terminal because the terminal emulator inherits its environment from my compositor, labwc (version 0.6.5), which has been rigged to ignore SIGPIPE since version 0.6.3 (see here).

If  yes  is running in an environment where SIGPIPE has been disabled, it will either error out with "Broken pipe" or will enter an infinite loop, depending on the situation. Either way, it will not behave as expected.

Rich:
Hi GNUser
So just to be clear, installing  coreutils  and executing the
following still results in an endless loop:

--- Code: ---$ echo "this is a test" >test.txt
$ /usr/local/bin/yes "password" | bcrypt test.txt
--- End code ---

GNUser:
No. In that scenario an error is displayed but no endless loop. It seems only busybox  yes  enters the endless loop when used with  bcrypt  .


--- Code: ---bruno@x230:~$ tce-load -wil coreutils
coreutils.tcz.dep OK
Downloading: coreutils.tcz
Connecting to gnuser.ddns.net (24.0.182.246:80)
saving to 'coreutils.tcz'
coreutils.tcz        100% |********************************| 2304k  0:00:00 ETA
'coreutils.tcz' saved
coreutils.tcz: OK
yes: Broken pipe
bruno@x230:~$ echo "this is a test" >test.txt
bruno@x230:~$ /usr/local/bin/yes "password" | bcrypt test.txt
Encryption key:
Again:
/usr/local/bin/yes: standard output: Broken pipe
bruno@x230:~$
--- End code ---

Rich:
Hi GNUser
And that's the point I was trying to make. GNU yes  prints
the error message after  bcrypt  completed successfully.
That's why I suggested it may be a  busybox  issue.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version