Bug 15256 - ash treats SIGWINCH as typed newline
Summary: ash treats SIGWINCH as typed newline
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-13 01:25 UTC by Elly
Modified: 2023-01-27 00:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
proposed fix (1.65 KB, patch)
2023-01-19 16:23 UTC, maribu
Details
proposed fix v2 (12.69 KB, patch)
2023-01-20 18:40 UTC, maribu
Details
proposed fix v3 (2.01 KB, patch)
2023-01-20 18:45 UTC, maribu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elly 2023-01-13 01:25:36 UTC
As the summary says. If you start ash, then resize the window it's in, ash acts as though you had typed a blank line. To reproduce this without resizing a window, you can start ash in one terminal then send SIGWINCH to it from another terminal; ash reacts by re-displaying the prompt on a new line as though an empty line had been typed.

This was introduced some time between 1_35_stable and 1_36_stable, maybe by 12566e7f9b5e5c5d445bc4d36991d134b431dc6c.
Comment 1 maribu 2023-01-19 16:23:43 UTC
Created attachment 9466 [details]
proposed fix

Hi,

the attached patch seems to fix the issue for me.

Cheers
Comment 2 maribu 2023-01-19 17:33:24 UTC
This seems to introduce a regression:

======================
echo -ne '' >input
echo -ne '33 3!4 3!!5
36
' | xxd -p -r
PASS: xxd -p -r ignores the nibble with 2nd char bad
make[1]: *** [/home/maribu/Repos/software/aports/main/bu

:/
Comment 3 maribu 2023-01-19 18:40:44 UTC
I have to correct myself: The tests are passing in the CI of Alpine Linux https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/43365

They are also failing for me without the patch on my machine. So there seems to be something affecting the tests on my local setup, rather than a regression that the unit tests would catch being introduced by the proposed patch.
Comment 4 maribu 2023-01-20 18:40:23 UTC
Created attachment 9471 [details]
proposed fix v2

The previous version still occasionally leaked a SIGWINCH instead of transparently handling it. With this new version of the patch I can no longer trigger the issue.
Comment 5 maribu 2023-01-20 18:45:12 UTC
Created attachment 9476 [details]
proposed fix v3

The v2 added a compile_commands.json by accident. (I used that for better code insight with clangd.) This is identical to v2 except not adding an unrelated file by accident.
Comment 6 Denys Vlasenko 2023-01-26 11:58:03 UTC
Fixed in git, please test.
Comment 7 Elly 2023-01-27 00:22:01 UTC
Tested at 93e0898c663a533082b5f3c2e7dcce93ec47076d and the bug is fixed :)