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

Add update mechanism for Terminfo, and common user-alias data #53285

Merged
merged 5 commits into from
Feb 23, 2024

Conversation

tecosaur
Copy link
Contributor

Now that we take care of terminfo parsing ourselves, having a clear origin and processing method for arriving at our reference terminfo data seems somewhat important.

The original form was acquired by re-purposing some pre-processed terminfo data from NCurses (I forget the exact source). I considered adding a separate ingestion/processing script, but it occurred to me that it would make sense to have the method for updating the data file be in the data file, by turning it into a quine.

This seems to work rather well, and so long as the NCurses source file format stays the same, updating the terminfo data is now dead simple.

While working on the terminfo files, some minor refactors popped up as "probably nice to have". One of which makes the reported number of flags/numbers/strings actually accurate.

Lastly, to support the ergonomic use of capability variable names instead of the short (read: uninformative) capname, we now also import the NCurses-recognised extended capabilities, and generate/specify some nice aliases for them.


If we separate out the terminfo parser/data into a small stdlib, the state here will be the initial state of the repo.

base/terminfo_data.jl Outdated Show resolved Hide resolved
Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

SGTM

@tecosaur tecosaur force-pushed the update-terminfo branch 2 times, most recently from a541793 to 67bbd97 Compare February 12, 2024 17:56
@vtjnash vtjnash added io Involving the I/O subsystem: libuv, read, write, etc. merge me PR is reviewed. Merge when all tests are passing labels Feb 12, 2024
test/terminfo.jl Outdated Show resolved Hide resolved
test/terminfo.jl Outdated Show resolved Hide resolved
Is it brilliant or cursed? That's up for debate, but I think it's neat.

This change also revealed some minor discrepancies between the NCurses
source (which we use nwo) and the processed source I originally
used (from some python package? I can't quite recall).

All of the minor discrepancies are cosmetic, with the exception of:
- memory_below moving down by one, and
- backspace_with_bs changing to backspace_if_not_bs

Since we are now using NCurses's source directly, I'm inclined to trust
these changes.
The preferred code to use is the "long" symbol, for readability when
used. I think it makes sense to have it as the first field to reflect
that. While we're at it, we may as well update the field names to better
indicate that "short" is the actual capname, and just call "long"
"name".
Using the tagged releases in the ncurses repository isn't actually a
good idea, since it fails to capture the patch releases made
subsequently.

Instead, we switch to grabbing the latest version and recording which
patch release it is. Normally, there would be a danger of grabbing
un-released changes, however this doesn't seem like an actual risk in
this case given how the ncurses repo seems to operate.
@tecosaur
Copy link
Contributor Author

I noticed that the NCurses release tags weren't quite right, so have tweaked the update logic, and updated again (so now we have the latest 6.4 release, not the initial 6.4 release).

Also, there are enough commits here worth keeping IMO that I'm going to slap a "don't squash" label on this.

@tecosaur tecosaur added the don't squash Don't squash merge label Feb 13, 2024
@tecosaur tecosaur added the backport 1.11 Change should be backported to release-1.11 label Feb 16, 2024
@fingolfin fingolfin merged commit 923fe2d into JuliaLang:master Feb 23, 2024
7 of 9 checks passed
@inkydragon inkydragon removed the merge me PR is reviewed. Merge when all tests are passing label Feb 24, 2024
@KristofferC KristofferC mentioned this pull request Feb 26, 2024
28 tasks
KristofferC pushed a commit that referenced this pull request Feb 26, 2024
Now that we take care of terminfo parsing ourselves, having a clear
origin and processing method for arriving at our reference terminfo data
seems somewhat important.

The original form was acquired by re-purposing some pre-processed
terminfo data from NCurses (I forget the exact source). I considered
adding a separate ingestion/processing script, but it occurred to me
that it would make sense to have the method for updating the data file
be _in_ the data file, by turning it into a quine.

This seems to work rather well, and so long as the NCurses source file
format stays the same, updating the terminfo data is now dead simple.

While working on the terminfo files, some minor refactors popped up as
"probably nice to have". One of which makes the reported number of
flags/numbers/strings actually accurate.

Lastly, to support the ergonomic use of capability variable names
instead of the short (read: uninformative) capname, we now also import
the NCurses-recognised extended capabilities, and generate/specify some
nice aliases for them.

-----

If we separate out the terminfo parser/data into a small stdlib, the
state here will be the initial state of the repo.

(cherry picked from commit 923fe2d)
maleadt pushed a commit that referenced this pull request Feb 26, 2024
Now that we take care of terminfo parsing ourselves, having a clear
origin and processing method for arriving at our reference terminfo data
seems somewhat important.

The original form was acquired by re-purposing some pre-processed
terminfo data from NCurses (I forget the exact source). I considered
adding a separate ingestion/processing script, but it occurred to me
that it would make sense to have the method for updating the data file
be _in_ the data file, by turning it into a quine.

This seems to work rather well, and so long as the NCurses source file
format stays the same, updating the terminfo data is now dead simple.

While working on the terminfo files, some minor refactors popped up as
"probably nice to have". One of which makes the reported number of
flags/numbers/strings actually accurate.

Lastly, to support the ergonomic use of capability variable names
instead of the short (read: uninformative) capname, we now also import
the NCurses-recognised extended capabilities, and generate/specify some
nice aliases for them.

-----

If we separate out the terminfo parser/data into a small stdlib, the
state here will be the initial state of the repo.

(cherry picked from commit 923fe2d)
KristofferC added a commit that referenced this pull request Mar 1, 2024
Backported PRs:
- [x] #53361 <!-- 🤖 [master] Bump the SparseArrays stdlib from c9f7293
to cb602d7 -->
- [x] #53300 <!-- allow external absint to hold custom data in
`codeinst.inferred` -->
- [x] #53342 <!-- Add `Base.wrap` to docs -->
- [x] #53372 <!-- Silence warnings in `test/file.jl` -->
- [x] #53357 <!-- 🤖 [master] Bump the Pkg stdlib from 6dd0e7c9e to
76070d295 -->
- [x] #53373 <!-- fix sysimage-native-code=no option with pkgimages -->
- [x] #53333 <!-- More consistent return value for annotations, take 2
-->
- [x] #53354 <!-- fix code coverage bug in tail position and `else` -->
- [x] #53407 <!-- fix sysimage-native-code=yes option -->
- [x] #53388 <!-- Fix documentation: thread pool of main thread -->
- [x] #53355 <!-- Fix synchronization issues on the GC scheduler. -->
- [x] #53429 <!-- Subtype: skip slow-path in `local_∀_∃_subtype` if
inputs contain no ∃ typevar. -->
- [x] #53437 <!-- Add debug variant of loader_trampolines.o -->
- [x] #53284 <!-- Add annotate! method for AnnotatedIOBuffer -->
- [x] #53466 <!-- [MozillaCACerts_jll] Update to v2023-12-12 -->
- [x] #53467 <!-- [LibGit2_jll] Update to v1.7.2 -->
- [x] #53326 <!-- RFC: when loading code for internal purposes, load
stdlib files directly, bypassing DEPOT_PATH, LOAD_PATH, and stale checks
-->
- [x] #53332
- [x] #53320 <!-- Add `Sys.isreadable, Sys.iswriteable`, update `ispath`
-->
- [x] #53476

Contains multiple commits, manual intervention needed:
- [ ] #53285 <!-- Add update mechanism for Terminfo, and common
user-alias data -->

Non-merged PRs with backport label:
- [ ] #53424 <!-- yet more atomics & cache-line fixes on work-stealing
queue -->
- [ ] #53408 <!-- task splitting: change additive accumulation to
multiplicative -->
- [ ] #53403 <!-- Move parallel precompilation to Base -->
- [ ] #53402 <!-- Add `jl_getaffinity` and `jl_setaffinity` -->
- [ ] #53391 <!-- Default to the medium code model in x86 linux -->
- [ ] #53125 <!-- coverage: count coverage where explicitly requested by
inference only -->
- [ ] #52694 <!-- Reinstate similar for AbstractQ for backward
compatibility -->
@KristofferC KristofferC removed the backport 1.11 Change should be backported to release-1.11 label Mar 1, 2024
tecosaur pushed a commit to tecosaur/julia that referenced this pull request Mar 4, 2024
…ang#53285)

Now that we take care of terminfo parsing ourselves, having a clear
origin and processing method for arriving at our reference terminfo data
seems somewhat important.

The original form was acquired by re-purposing some pre-processed
terminfo data from NCurses (I forget the exact source). I considered
adding a separate ingestion/processing script, but it occurred to me
that it would make sense to have the method for updating the data file
be _in_ the data file, by turning it into a quine.

This seems to work rather well, and so long as the NCurses source file
format stays the same, updating the terminfo data is now dead simple.

While working on the terminfo files, some minor refactors popped up as
"probably nice to have". One of which makes the reported number of
flags/numbers/strings actually accurate.

Lastly, to support the ergonomic use of capability variable names
instead of the short (read: uninformative) capname, we now also import
the NCurses-recognised extended capabilities, and generate/specify some
nice aliases for them.

-----

If we separate out the terminfo parser/data into a small stdlib, the
state here will be the initial state of the repo.
@tecosaur tecosaur deleted the update-terminfo branch August 11, 2024 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
don't squash Don't squash merge io Involving the I/O subsystem: libuv, read, write, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants