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

Using stderred with tmux makes all text red #52

Open
andrewbenton opened this issue Sep 6, 2016 · 4 comments · May be fixed by #68
Open

Using stderred with tmux makes all text red #52

andrewbenton opened this issue Sep 6, 2016 · 4 comments · May be fixed by #68

Comments

@andrewbenton
Copy link

When using tmux, even when setting STDERRED_BLACKLIST or setting LD_PRELOAD to empty before starting, all text in bash under tmux is highlighted in red. Running bash after entering tmux will revert the text color to the default.

@twmccart
Copy link

twmccart commented Nov 8, 2018

Is there a better fix for this than "run bash"?

@rico-chet
Copy link

rico-chet commented Dec 29, 2018

I guess the issue here is that LD_PRELOAD contains the stderred.so twice when you put the export directive from the documentation verbatim to your ~/.bashrc because it is run twice (once in the non-tmux-ed bash and once in the bash that tmux starts for you).

So either put an include guard in your ~/.bashrc or start tmux with (unset LD_PRELOAD; tmux) (both works for me).

EDIT: Just use (unset LD_PRELOAD; tmux) and you're good.
EDIT: I found that export STDERRED_BLACKLIST='^(-bash)$' does the trick. I guess it's a good idea to hard-code -bash in the built-in blacklist as done with the bash here: https://github.com/sickill/stderred/blob/399e3b199c6de0ac6fdda3c30fb845ff36a75b1f/src/stderred.c#L40

@twmccart
Copy link

twmccart commented Jan 2, 2019

@rico-chet Why not hard-code it and submit a pull request?

@rico-chet
Copy link

@twmccart I wanted to find out first where the leading dash is coming from and whether a non-standard tmux config would possibly break the check. I found this: https://github.com/tmux/tmux/blob/c9d482ab489d5d57d481858091608ee1b32e46ab/window.c#L993
and this: tmux/tmux@22d1b94.

So just checking for the -%s pattern (not just -bash) seems much more feasible now.

rico-chet pushed a commit to rico-chet/stderred that referenced this issue Jan 3, 2019
`tmux` (https://github.com/tmux/tmux/wiki) is a terminal multiplexer,
like `screen`. It spawns its terminals with a '-' prefixed in `argv[0]`,
thus breaking `stderred`'s early return on `bash` encounter. This leads
to normal text being always red.

Refer to https://github.com/tmux/tmux/blob/c9d482ab489d5d57d481858091608ee1b32e46ab/window.c#L993
and to tmux/tmux@22d1b94.

Fixes ku1ik#52
rico-chet pushed a commit to rico-chet/stderred that referenced this issue Jan 3, 2019
`tmux` (https://github.com/tmux/tmux/wiki) is a terminal multiplexer,
like `screen`. It spawns its terminals with a '-' prefixed in `argv[0]`,
thus breaking `stderred`'s early return on `bash` encounter. This leads
to normal text being always red.

When `PROGRAM_NAME` matches the '-%s' format pattern, treat it as a
shell and return early.

Refer to https://github.com/tmux/tmux/blob/c9d482ab489d5d57d481858091608ee1b32e46ab/window.c#L993
and to tmux/tmux@22d1b94.

Fixes ku1ik#52
rico-chet pushed a commit to rico-chet/stderred that referenced this issue Jan 3, 2019
`tmux` (https://github.com/tmux/tmux/wiki) is a terminal multiplexer,
like `screen`. It spawns its terminals with `argv[0]` prefixed with a
'-', thus breaking `stderred`'s early return on `bash` encounter. This
leads to normal text being always red.

When `PROGRAM_NAME` matches the '-%s' format pattern, treat it as a
shell and return early.

Refer to https://github.com/tmux/tmux/blob/c9d482ab489d5d57d481858091608ee1b32e46ab/window.c#L993
and to tmux/tmux@22d1b94.

Fixes ku1ik#52
@rico-chet rico-chet linked a pull request Jan 3, 2019 that will close this issue
saagarjha pushed a commit to saagarjha/stderred that referenced this issue Feb 26, 2020
`tmux` (https://github.com/tmux/tmux/wiki) is a terminal multiplexer,
like `screen`. It spawns its terminals with `argv[0]` prefixed with a
'-', thus breaking `stderred`'s early return on `bash` encounter. This
leads to normal text being always red.

When `PROGRAM_NAME` matches the '-%s' format pattern, treat it as a
shell and return early.

Refer to https://github.com/tmux/tmux/blob/c9d482ab489d5d57d481858091608ee1b32e46ab/window.c#L993
and to tmux/tmux@22d1b94.

Fixes ku1ik#52
rico-chet pushed a commit to rico-chet/stderred that referenced this issue Jan 3, 2022
`tmux` (https://github.com/tmux/tmux/wiki) is a terminal multiplexer,
like `screen`. It spawns its terminals with `argv[0]` prefixed with a
'-', thus breaking `stderred`'s early return on `bash` encounter. This
leads to normal text being always red.

When `PROGRAM_NAME` matches the '-%s' format pattern, treat it as a
shell and return early.

Refer to https://github.com/tmux/tmux/blob/c9d482ab489d5d57d481858091608ee1b32e46ab/window.c#L993
and to tmux/tmux@22d1b94.

Fixes ku1ik#52
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

Successfully merging a pull request may close this issue.

3 participants