Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel Output Wrapping #726

Open
crftbt opened this issue Jul 23, 2024 · 6 comments
Open

Parallel Output Wrapping #726

crftbt opened this issue Jul 23, 2024 · 6 comments
Assignees

Comments

@crftbt
Copy link

crftbt commented Jul 23, 2024

Hello, what would cause the output to wrap, instead of having a new line, when Parallel is enabled with OpenRC?

Details from https://gitlab.alpinelinux.org/alpine/aports/-/issues/16226#note_423126

@navi-desu
Copy link
Member

hmm, that's odd... output from openrc at boot when rc_parallel is set, should be

<service 1 name> | <service 1 output>                   [ ok ]
<service 3 name> | <service 3 output>                   [ ok ]
<service 2 name> | <service 2 output>                   [ ok ]

sometimes it does print two of those on the same line (a bug, i assume), but on my testing it was rare, so i wonder if there's any kind of specific configuration options to trigger that reported behavior?

note that rc_parallel has some quirks and bugs, which i intend on fixing

@crftbt
Copy link
Author

crftbt commented Jul 24, 2024

hmm, that's odd... output from openrc at boot when rc_parallel is set, should be

<service 1 name> | <service 1 output>                   [ ok ]
<service 3 name> | <service 3 output>                   [ ok ]
<service 2 name> | <service 2 output>                   [ ok ]

sometimes it does print two of those on the same line (a bug, i assume), but on my testing it was rare, so i wonder if there's any kind of specific configuration options to trigger that reported behavior?

note that rc_parallel has some quirks and bugs, which i intend on fixing

What information in particular would be needed to debug this particular situation?

@navi-desu
Copy link
Member

openrc version and a rc.conf which i can reproduce that i think, since in master with just "rc_parallel=Yes" the output is lined up for me

@navi-desu navi-desu self-assigned this Sep 22, 2024
@sertonix
Copy link

I think I now know what the problem is. openrc seems to uses different output formats depending on what it is outputting to (I would guess tty or pipe).

In my case the openrc logs are handled by s6-linux-init which writes the logs into multiple locations.

@navi-desu
Copy link
Member

just looked at the code, if the output is a color terminal, libeinfo uses a built-in version of tgoto to move back to the same line it originally printed

but if stdout isn't a supported terminal, it simply prints spaces and the [ OK ], leading to piped output being a jumbled mess with rc_parallel on, as we can't jump back

i'm unsure how to proceed with this, some sort of buffering could work, or instead we could simplify the output should rc_parallel be enabled and the tty not a color term? aka print the whole line again, not just the ending

@sertonix
Copy link

Maybe print every message with the service line prefixed and always a newline afterwords. Like this:

<service 1 name> | <service 1 output>
<service 3 name> | <service 3 output>
<service 3 name> | [ ok ]
<service 2 name> | <service 2 output>
<service 1 name> | [ ok ]
<service 2 name> | [ ok ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants