LemonBoy / bar

A featherweight, lemon-scented, bar based on xcb
MIT License
1.62k stars 194 forks source link

Fix buffering bug: use read() for reading instead of fgets() #198

Closed shdown closed 6 years ago

shdown commented 7 years ago

stdin is buffered and using fgets() invokes read(), which could read multiple lines at one, while reporting only first of them.

Testcase:

{ echo a; echo b; while sleep 1; do :; done; } | lemonbar

only outputs a.

seamus-45 commented 7 years ago

This is fix for #107

shdown commented 7 years ago

Oh, there's already another PR for this. Well, feel free to close then.

shdown commented 6 years ago

@LemonBoy could you please run the following and tell us if what you see is the intended behaviour: { echo a; echo b; while sleep 1; do :; done; } | lemonbar

LemonBoy commented 6 years ago

I don't have much interest/bandwidth at the moment but here's my 2cents: the added code is too much, too hairy and may introduce breakage for other people. Fix your script to produce a single line or whatever.

shdown commented 6 years ago

I don't have much interest/bandwidth at the moment

This is understandable, but closing the pull request may create an illusion that lemonbar doesn’t have this critical bug. I’m not exaggerating.

may introduce breakage for other people.

Really? In what way?

Fix your script

There is no possible fix to the script; this is bug in your program. If you were not that ignorant, you would realize that.

to produce a single line or whatever.

Uh… what? Single line? Your bar reads stdin line-by-line. That’s okay. But sometimes it ignores lines. That’s the problem.

LemonBoy commented 6 years ago

closing the pull request may create an illusion that lemonbar doesn’t have this critical bug

The issue is still open.

critical bug. I’m not exaggerating.

You are over-reacting. Feel free to patch your local copy if you feel threatened by such a "bug" that I (and many other) didn't stumble upon in years of daily usage.

Really? In what way?

My old statusbar setup for example, see issue #107. Too bad I don't have that setup working anymore to debug the problem.

There is no possible fix to the script; this is bug in your program.

Meh, I never had this problem.

If you were not that ignorant

This is where this conversation ends, please learn some manners.

shdown commented 6 years ago

My old statusbar setup for example, see issue #107. Too bad I don't have that setup working anymore to debug the problem.

Not the case with my patch.

Feel free to patch your local copy if you feel threatened by such a "bug" that I (and many other) didn't stumble upon in years of daily usage.

But some, apparently, did stumble: https://github.com/shdown/luastatus/issues/12#issuecomment-277621325

This is where this conversation ends, please learn some manners.

I still ask you to investigate this when you have time.