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

Too many levels of symbolic links at share/terminfo/N/NCR260VT300WPP #231

Open
oxidase opened this issue Mar 12, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@oxidase
Copy link

oxidase commented Mar 12, 2024

In 5246d4e --enable-symlinks creates a circular symlink in case-insensitive file systems like APFS.

share/terminfo/N/NCR260VT300WPP --> ../n/ncr260vt300wpp

which leads to problems with globs in bazel.

The fix must be included into upstream and as an interim solution --enable-symlinks can be commented out.

@oxidase
Copy link
Author

oxidase commented Mar 12, 2024

It looks like the issue was addressed on 2000/11/11

20001111
	+ modify _nc_write_entry() to allow for the possibility that linking
	  aliases on a filesystem that ignores case would not succeed because
	  the source and destination differ only by case, e.g., NCR260VT300WPP0
	  on cygwin (report by Neil Zanella).

For terminfo built on a case-sensitive FS glob fails on a case-insensitive FS with enabled symlinks.

@indygreg indygreg added the bug Something isn't working label Mar 16, 2024
@indygreg
Copy link
Owner

Ugh. This bug just shouldn't exist in the terminfo database :/

FWIW I enabled symlinks because by default hardlinks are created. And hardlinks and tar archives don't exactly play well together.

It looks like by default the terminfo database has directories like A, B, C, a, b, c, etc. Obviously not compatible with case insensitive filesystems.

terminfo does have a --disable-mixed-case configure flag. This appears to swap out the top-level directory with the ASCII hex encoding equivalent. e.g. 41, 42, 43, 61, 62, 63.

It appears the macOS terminfo database uses this --disable-mixed-case mode (see /usr/share/terminfo on a macOS machine).

We can add --disable-mixed-case to produce a terminfo database that doesn't cause problems for case insensitive filesystems.

But, it appears that --disable-mixed-case changes the semantics for ncurses to resolve filesystem paths at run-time as well. If you build ncurses with --disable-mixed-case, it looks for entries using the hex encoding instead of the ascii letter. So if we pick up the /usr/share/terminfo database from the Linux host, it will fail to find files because it is looking in the wrong location.

I added a copy of the terminfo database to the tar archives for convenience. I doubt most consumers will actually use the terminfo database from the archives directly because this requires setting up an environment variable to point ncurses at a non-default directory containing the database.

Since the terminfo database isn't usable out of the box, I'm tempted to either delete it. Or if people think it could be useful, we could package it as a nested tar archive so downstream consumers could extract it. This will solve the problem of a case insensitive tar extractor not being able to extract the archive due to case conflicting symlinks.

aignas added a commit to aignas/rules_python that referenced this issue May 14, 2024
…hains

This affects Linux toolchains that have the `terminfo` databases bundled
with the toolchain. Our solution to this is to remove the
`share/terminfo` altogether if we are downloading an affected `linux`
toolchain.

Workaround indygreg/python-build-standalone#231
Fixes bazelbuild#1800
github-merge-queue bot pushed a commit to bazelbuild/rules_python that referenced this issue May 14, 2024
…hains (#1898)

This affects Linux toolchains that have the `terminfo` databases bundled
with the toolchain. Our solution to this is to remove the
`share/terminfo` altogether if we are downloading an affected `linux`
toolchain.

Tested with (on a Mac):
```console
bazel build --platforms=//tests/support:linux_x86_64 @python_3_11//:files
bazel build --platforms=//tests/support:windows_x86_64 @python_3_11//:files
```

Workaround
indygreg/python-build-standalone#231
Fixes #1800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants