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

[ncurses] set TERMINFO_DIRS environment variable #6994

Merged
merged 1 commit into from
Jul 4, 2023

Conversation

fingolfin
Copy link
Member

See JuliaPackaging/BinaryBuilder.jl#687

The recent change by @barche in PR #6980 reminded me about this.

(I should have done it with my recent ncurses 6.4 update sigh but since ncurses only seems to use versions of the form MAJOR.MINOR, it should be OK to use this fake version)

@@ -88,5 +88,11 @@ dependencies = [
HostBuildDependency("Ncurses_jll"),
]

init_block = raw"""
if Sys.isunix()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not even sure we need this... Adapted it from Xorg_xkeyboard_config

@@ -88,5 +88,11 @@ dependencies = [
HostBuildDependency("Ncurses_jll"),
]

init_block = raw"""
if Sys.isunix()
ENV["TERMINFO"] = get(ENV, "TERMINFO", joinpath(Ncurses_jll.artifact_dir, "share", "terminfo"))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I also adapted from Xorg_xkeyboard_config -- it only sets TERMINFO to point at the artifact if it wasn't already set. So the user can still set their own TERMINFO.

However, looking at man terminfo, it seems the precedence is TERMINFO > $HOME/.terminfo > TERMINFO_DIRS so perhaps I should set TERMINFO_DIRS here instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am aware of that issue, and in fact I am using the withenv workaround myself in GAP.jl. However, it is limited: I have code paths the user triggers which could also in the end need this. It is not practical to repeat the withenv in all code. So I think addressing this once and forall here makes sense.

Of course there is a hypothetical chance we'll break something. But that's true for almost any change we make. We'll deal with it if we get reports about it? In the worst case we can revert this change here -- of course we'll then (re-)break other things, but such is life.... ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is that I just set the variable globally in GAP.jl, then it'll be limited in which code the change affects -- so breakage still is possible, but minimized shrug

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, especially for ccalls into library wrapping every single call with withenv is annoying.

@giordano giordano changed the title [ncurses] set TERMINFO environment variable [ncurses] set TERMINFO_DIRS environment variable Jul 3, 2023
@@ -88,5 +88,11 @@ dependencies = [
HostBuildDependency("Ncurses_jll"),
]

init_block = raw"""
if Sys.isunix()
ENV["TERMINFO_DIRS"] = get(ENV, "TERMINFO_DIRS", joinpath(artifact_dir, "share", "terminfo"))
Copy link
Contributor

@benlorenz benlorenz Jul 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should append our path at the end (colon-separated) when there is already a TERMINFO_DIRS variable set?
Just to make sure that a valid directory is in there since there are different variants of how this directory is organized (using characters or ascii-decimal numbers for the subfolders), and this is a compile-time flag.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@fingolfin fingolfin merged commit 133c8cc into JuliaPackaging:master Jul 4, 2023
@fingolfin fingolfin deleted the mh/ncurses branch July 4, 2023 07:10
@giordano
Copy link
Member

giordano commented Jul 5, 2023

I just realised this PR makes https://github.com/giordano/Htop.jl redundant, as it was just setting TERMINFO_DIRS, I think I'll delete the repo, Htop_jll is enough now. Thanks!

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 this pull request may close these issues.

3 participants