ii8 / havoc

minimal terminal emulator for wayland
Other
103 stars 17 forks source link

yes command causes "Broken pipe" errors in terminal #50

Closed bdantas closed 9 months ago

bdantas commented 9 months ago

I have two Tiny Core Linux boxes. One runs X with fluxbox and has various terminal emulators (aterm, urxvt, xterm). The other box has Wayland with labwc and has havoc terminal emulator.

Shell scripts that use the yes command work fine in all terminal emulators in X. In havoc, at best the scripts show errors like this (when using Busybox):

yes: Broken pipe

or like this (when using GNU coreutils):

yes: standard output: Broken pipe

At worse, the script hangs indefinitely, causes CPU usage to go way up, and laptop fans to come on. I can reproduce this worse case scenario in havoc with this command:

yes "myPassword" | bcrypt someFile.txt

Any ideas what the issue is and how to fix?

EDIT: I should have given some details about my setup. havoc: 0.5.0-git wayland: 1.22.0 labwc: 0.6.5 OS: Tiny Core Linux 14 x86_64 linux: 6.1.2 busybox: 1.36.0 coreutils: 9.1

ii8 commented 9 months ago

I have tried a bunch of combinations of libc, coreutils, compositor and OS but I cannot reproduce this problem. Is it possible to reproduce it in some way that I can see it, like a docker image?

How are you building havoc? From what source and with what options?

At first glance I would guess that this is unlikely to be related to havoc because the pipe is created by the shell and has nothing to do with the terminal emulator.

bdantas commented 9 months ago

Hi ii8. I didn't build it, but know it was version 0.5.0 from git. Build details are here: http://repo.tinycorelinux.net/14.x/x86_64/tcz/src/havoc/compile_havoc

I tried different shells (busybox ash and bash) in havoc and both shells are affected. But it turns out that weston-terminal is also affected. Since different terminal emulators are affected, my guess is that this has something to do with how the wayland session is being started and is not specific to havoc.

bdantas commented 9 months ago

Hello again, ii8. Don't seem to be specific to havoc, I'll close this issue.

Nevertheless, I'd appreciate your help solving this if you'd be so kind. Tiny Core Linux is probably the most minimalistic distro around, which is why I love it so much. The upside is that user is in complete control. "Downside" is that user better know what they are doing, and a misstep early in boot process can lead to unexpected behaviors later on.

My box boots to a CLI console. I start wayland and my preferred compositor (labwc) with this command at the console:

sudo -- seatd -g staff -n /run/seatd.sock & XDG_RUNTIME_DIR=/run/user/$(id -u) labwc

Could this way of starting wayland/labwc have anything to do with the "Broken pipe" error when using yes in terminal emulators?

ii8 commented 9 months ago

I also doubt that it's related to how wayland is started. Though I don't have any better idea what it might be. Is it the same for all pipes that the shell creates? For example if you do ls | sort does that also cause problems? You could also try running yes with a pipe before you start the wayland compositor, just in the linux console, to see if it makes a difference.

bdantas commented 9 months ago

In havoc, ls | sort and all other pipelines work fine. Strangely, the problem seems limited to pipelines containing yes command.

In the linux console there are no problems. All pipes work, including those with yes.

I'm puzzled that the transition from console to wayland graphical session breaks only this one small thing AFAIK. Fortunately, yes is a trivial command and most things are working just fine. Don't worry about it. If I find an explanation, I'll share it here.

ii8 commented 9 months ago

You could also try to make a program similar to yes. Make a little script that outputs a letter in a loop forever and see if that also breaks in the same way.

Does it also break if you just run yes on it's own, without piping it anywhere?

Are there strange permissions set on the yes executable or it's path perhaps?

bdantas commented 8 months ago

Culprit was my compositor (labwc), which was disabling SIGPIPE in my entire GUI environment. This fixed the issue: https://github.com/labwc/labwc/pull/1210 Thank you very much for your help!