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

Error messages from less in version 1.3.2 #207

Open
praxanz opened this issue May 3, 2024 · 0 comments
Open

Error messages from less in version 1.3.2 #207

praxanz opened this issue May 3, 2024 · 0 comments

Comments

@praxanz
Copy link

praxanz commented May 3, 2024

With the environment variable PAGER unset, running csview with a filename, results in less showing the error message:

There is no -<E8> option ("less --help" for help)
Press RETURN to continue

when using standard input, the error is:

There is no -l option ("less --help" for help)
Press RETURN to continue

Running these commands with ltrace shows that when the string LESS=-SF is passed to the function putenv(), the trailing null character is missing and extra garbage characters are added to the environment variable:

putenv("LESS=-SF\350\331\002\354p") or putenv("LESS=-SFless")

Not being a rust programmer, I don't know the best way to correct this, but as a workaround, either one of the quick and dirty patches below fixes the issue for me.

In main.rs replace the line

Err(_) => Pager::with_pager("less").pager_envs(["LESS=-SF"]).setup(), 

with either

Err(_) => Pager::with_pager("less").pager_envs(["LESS=-SF\0"]).setup(),

or else with

Err(_) => Pager::with_pager("less -SF").setup(),

testing environment

TERMUX_APK_RELEASE=F_DROID
TERMUX_VERSION=0.118.0
Packages CPU architecture: aarch64
Android version: 14
rustc 1.78.0 (9b00956e5 2024-04-29) (built from a source tarball)
csview 1.3.2
~/.cargo/registry/src/index.crates.io-.../pager-0.16.1/
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

1 participant