On Mi, 16.10.24 15:37, Barry Scott (barry@xxxxxxxxxxxxxxxx) wrote: [I am aware you reported this issue on https://github.com/systemd/systemd/issues/34604 before. Some more comments below.] > I'm tracking down an issue with then run0 command in f41. > > In a KDE konsole terminal run0 fails to work after > stty intr ^g ^G is BEL btw, i.e. you are redefining what happens if something generates an event that shall ring the terminal bell, and turn it into SIGINT. Which is really really weird. I mean, there might be some bug lurking somewhere, but this definitely *is* a really really weird thing to do. You didn't mention which terminal precisely your are doing this weird config on though: before you invoke run0 (i.e on your terminal app's pty) or while you are inside of run0 (i.e. on run0's pty). This matters a lot and makes a major difference. note that when run0 operates it will temporarily turn off any handling of keypresses on the terminal app's pty (let's call it the "outer" one), by putting the pty into raw mode (via cfmakeraw()). This should mean that ^G should be deliverd to run0 as ^G, which it then forwards to the other pty (the "inner" one). Which won't handle it, because we do not redefine keycodes on the inner one. So the app on the other end (likely your shell?) will receive ^G. Most shells will respond to that via echoing it back, which should generate a bell event. > > It just exits without an error message, exit code 130. > > Running run0 via gdb or strace makes things work. > Which leaves me with fprintf debugging. > > I have been adding fprintf to the code to trace the path > of execution and print key information. > > What I am seeing is very odd. > > For the following code the ppoll does not return, the process exits. > > From io-utils.c:191 > > int ppoll_usec(struct pollfd *fds, size_t nfds, usec_t timeout) { > int r; > > fprintf(stderr, "QQQ io-util.c:194 ppoll_usec\n"); > > assert(fds || nfds == 0); > > /* This is a wrapper around ppoll() that does primarily two things: > * > * ✅ Takes a usec_t instead of a struct timespec > * > * ✅ Guarantees that if an invalid fd is specified we return EBADF (i.e. converts POLLNVAL to > * EBADF). This is done because EBADF is a programming error usually, and hence should bubble up > * as error, and not be eaten up as non-error POLLNVAL event. > * > * ⚠️ ⚠️ ⚠️ Note that this function does not add any special handling for EINTR. Don't forget > * poll()/ppoll() will return with EINTR on any received signal always, there is no automatic > * restarting via SA_RESTART available. Thus, typically you want to handle EINTR not as an error, > * but just as reason to restart things, under the assumption you use a more appropriate mechanism > * to handle signals, such as signalfd() or signal handlers. ⚠️ ⚠️ ⚠️ > */ > > if (nfds == 0) > return 0; > > fprintf(stderr, "QQQ io-util.c:216 ppoll_usec\n"); > const struct timespec *tmp_timeout = timeout == USEC_INFINITY ? NULL : TIMESPEC_STORE(timeout); > fprintf(stderr, "QQQ io-util.c:218 ppoll_usec fds %d nfds %lu timeout %lu\n", fds[0].fd, nfds, timeout); > r = ppoll(fds, nfds, tmp_timeout, NULL); > fprintf(stderr, "QQQ io-util.c:220 ppoll_usec r %d\n", r); > > > I see the fprintf for line 218 but not for 220 is stty intr ^g has been run. > > It seems that the ppoll call kills the process and I see an exit code of 130. > > I'm not sure how to further the debugging process. > > How can I make progress on this problem? > > Here are the fprintf logs from working and not working. > > $ LD_LIBRARY_PATH=../BUILD/systemd-256.7-build/systemd-256.7/redhat-linux-build/src/shared ../BUILD/systemd-256.7-build/BUILDROOT/usr/bin/run0QQQ run.c:2355 > QQQ run.c:2362 > QQQ run.c:788 parse_argv_sudo_mode > QQQ run.c:883 parse_argv_sudo_mode > QQQ run.c:898 parse_argv_sudo_mode > QQQ run.c:901 parse_argv_sudo_mode arg_stdio 1 > QQQ run.c:934 parse_argv_sudo_mode > QQQ run.c:974 parse_argv_sudo_mode > QQQ run.c:984 parse_argv_sudo_mode > QQQ pretty-print.c:423 terminal_tint_color 3 > QQQ terminal-util.c:1728 get_default_background_colors > QQQ terminal-util.c:1746 get_default_background_colors > QQQ terminal-util.c:1758 get_default_background_colors > QQQ terminal-util.c:1769 get_default_background_colors > QQQ terminal-util.c:1779 get_default_background_colors > QQQ io-util.c:238 fd_wait_for_event > QQQ io-util.c:194 ppoll_usec > QQQ io-util.c:216 ppoll_usec > QQQ io-util.c:218 ppoll_usec fds 0 nfds 1 timeout 100000 > QQQ io-util.c:220 ppoll_usec r 1 > QQQ io-util.c:245 fd_wait_for_event ppoll_usec r 1 > QQQ io-util.c:245 fd_wait_for_event ppoll_usec pollfd.revents 1 > QQQ terminal-util.c:1782 get_default_background_colors fd_wait_for_event r 1 > QQQ terminal-util.c:1792 get_default_background_colors read(STDIN_FILENO,) l 24 > QQQ terminal-util.c:1802 get_default_background_colors > QQQ terminal-util.c:1809 get_default_background_colors > QQQ pretty-print.c:423 terminal_tint_color get_default_background_color r 0 > QQQ pretty-print.c:430 terminal_tint_color > QQQ pretty-print.c:444 terminal_tint_color > QQQ pretty-print.c:449 terminal_tint_color > QQQ run.c:989 parse_argv_sudo_mode > QQQ run.c:2364 parse_argv_sudo_mode r 1 > QQQ run.c:2366 r 1 > QQQ io-util.c:194 ppoll_usec > QQQ io-util.c:216 ppoll_usec > QQQ io-util.c:218 ppoll_usec fds 3 nfds 1 timeout 24999993 > QQQ io-util.c:220 ppoll_usec r 1 > QQQ io-util.c:194 ppoll_usec > QQQ io-util.c:216 ppoll_usec > QQQ io-util.c:218 ppoll_usec fds 3 nfds 1 timeout 24999996 > QQQ io-util.c:220 ppoll_usec r 1 > QQQ io-util.c:238 fd_wait_for_event > QQQ io-util.c:194 ppoll_usec > QQQ io-util.c:216 ppoll_usec > QQQ io-util.c:218 ppoll_usec fds 6 nfds 1 timeout 18446744073709551615 > QQQ io-util.c:220 ppoll_usec r 1 > QQQ io-util.c:245 fd_wait_for_event ppoll_usec r 1 > QQQ io-util.c:245 fd_wait_for_event ppoll_usec pollfd.revents 16 > QQQ io-util.c:194 ppoll_usec > QQQ io-util.c:216 ppoll_usec > QQQ io-util.c:218 ppoll_usec fds 3 nfds 1 timeout 24999991 > QQQ io-util.c:220 ppoll_usec r 1 > Failed to start transient service unit: Access denied > > $ stty intr ^g > $ LD_LIBRARY_PATH=../BUILD/systemd-256.7-build/systemd-256.7/redhat-linux-build/src/shared ../BUILD/systemd-256.7-build/BUILDROOT/usr/bin/run0 > QQQ run.c:2355 > QQQ run.c:2362 > QQQ run.c:788 parse_argv_sudo_mode > QQQ run.c:883 parse_argv_sudo_mode > QQQ run.c:898 parse_argv_sudo_mode > QQQ run.c:901 parse_argv_sudo_mode arg_stdio 1 > QQQ run.c:934 parse_argv_sudo_mode > QQQ run.c:974 parse_argv_sudo_mode > QQQ run.c:984 parse_argv_sudo_mode > QQQ pretty-print.c:423 terminal_tint_color 3 > QQQ terminal-util.c:1728 get_default_background_colors > QQQ terminal-util.c:1746 get_default_background_colors > QQQ terminal-util.c:1758 get_default_background_colors > QQQ terminal-util.c:1769 get_default_background_colors > QQQ terminal-util.c:1779 get_default_background_colors > QQQ io-util.c:238 fd_wait_for_event > QQQ io-util.c:194 ppoll_usec > QQQ io-util.c:216 ppoll_usec > QQQ io-util.c:218 ppoll_usec fds 0 nfds 1 timeout 99999 > > $ > > > -- > _______________________________________________ > devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx > To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx > Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ > List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines > List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx > Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue Lennart -- Lennart Poettering, Berlin -- _______________________________________________ devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue