Skip to content

update-alternatives fixes and improvements. #25113

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

Merged
merged 38 commits into from
Jun 30, 2025

Conversation

TomJo2000
Copy link
Member

This PR handles a few outstanding issues related to the alternatives system provided by dpkg's update-alternatives.

  • 1.) Make nano the default $PREFIX/bin/editor.
    Currently the editor with the highest priority is vim, which isn't shipped as part of the bootstrap but will override the editor executable when installed.
    To avoid user confusion due to this, default to nano instead which is the editor we ship as part of the bootstrap.
  • 2.) Making ncat-openbsd and nmap-ncat no longer conflict.
    This PR adds an nc alternative group utilized by ncat-openbsd and nmap and resolves the file overlaps between the two packages.
    It also removes the now unnecessary nmap-ncat subpackage in favor of making ncat-nmap part of the nmap package.
  • 3.) Replacing default editor compilation options with $PREFIX/bin/editor.
    I have set the compile time default editors for the cronie, w3m and (new with this PR) less packages to editor to better align with user preferences.
    In conjunction with the promotion of nano to default editor this change does not change the defaults for cronie or w3m.
    It does change the implicit default editor for less to nano instead of the project default vi.

@TomJo2000 TomJo2000 requested a review from Grimler91 as a code owner June 19, 2025 23:59
@TomJo2000 TomJo2000 force-pushed the update-alternatives-fixes branch 2 times, most recently from bf18de2 to 38dfa64 Compare June 20, 2025 00:37
@TomJo2000 TomJo2000 force-pushed the update-alternatives-fixes branch 3 times, most recently from c91be62 to cca660b Compare June 20, 2025 16:52
@TomJo2000
Copy link
Member Author

I've now added a pager group.
It currently only includes less (50, default), more (25) and cat (1, last resort).

I'll be adding additional pager utilities in separate commits.

Additionally busybox can also provide nc, though I have only assigned it a priority of 10 for this purpose (same for its ability to provide vi and editor).

@TomJo2000 TomJo2000 force-pushed the update-alternatives-fixes branch from cca660b to 3b69edc Compare June 20, 2025 17:19
@TomJo2000
Copy link
Member Author

If there's any pager candidates I missed or any other groups that would make sense to add please leave a comment here.

@TomJo2000 TomJo2000 force-pushed the update-alternatives-fixes branch from 3b69edc to b9f95b4 Compare June 20, 2025 18:47
@robertkirkman
Copy link
Contributor

When I look, it appears that Debian's build of git sets both DEFAULT_PAGER=pager and DEFAULT_EDITOR=editor, but termux's git doesn't.

https://repo.or.cz/git/debian.git/blob/77c0fc1dd8601a9552369b9e9ee95d129fe26aa1:/debian/rules#l17

TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
ac_cv_fread_reads_directories=yes
ac_cv_header_libintl_h=no
ac_cv_iconv_omits_bom=no
ac_cv_snprintf_returns_bogus=no
--with-curl
--with-expat
--with-shell=$TERMUX_PREFIX/bin/sh
--with-tcltk=$TERMUX_PREFIX/bin/wish

I think that would be another program that pager and editor should be set for.

@TomJo2000
Copy link
Member Author

When I look, it appears that Debian's build of git sets both DEFAULT_PAGER=pager and DEFAULT_EDITOR=editor, but termux's git doesn't.

https://repo.or.cz/git/debian.git/blob/77c0fc1dd8601a9552369b9e9ee95d129fe26aa1:/debian/rules#l17

TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
ac_cv_fread_reads_directories=yes
ac_cv_header_libintl_h=no
ac_cv_iconv_omits_bom=no
ac_cv_snprintf_returns_bogus=no
--with-curl
--with-expat
--with-shell=$TERMUX_PREFIX/bin/sh
--with-tcltk=$TERMUX_PREFIX/bin/wish

I think that would be another program that pager and editor should be set for.

That can be arranged.

@TomJo2000 TomJo2000 force-pushed the update-alternatives-fixes branch 2 times, most recently from f866562 to a43fe87 Compare June 20, 2025 20:52
@robertkirkman
Copy link
Contributor

robertkirkman commented Jun 21, 2025

While looking for other programs that might contain vi as the default editor, I found two more: bashbug and gawkbug.

However, while gawkbug is present in Termux, bashbug is removed before distribution. bashbug can only be obtained in Termux by rebuilding the package.

It seems like it makes sense, since bugs in bash in Termux should not be reported directly to upstream (if not reproducible on PC), they should first be reported here and then forwarded if necessary.

Maybe gawk's build.sh should be edited to make it remove gawkbug like how bash removes bashbug?

TERMUX_PKG_RM_AFTER_INSTALL="share/man/man1/bashbug.1 bin/bashbug"

@TomJo2000
Copy link
Member Author

While looking for other programs that might contain vi as the default editor, I found two more: bashbug and gawkbug.

However, while gawkbug is present in Termux, bashbug is removed before distribution. It bashbug can only be obtained in Termux by rebuilding the package.

It seems like it makes sense, since bugs in bash in Termux should not be reported directly to upstream (if not reproducible on PC), they should first be reported here and then forwarded if necessary.

Maybe gawk's build.sh should be edited to make it remove gawkbug like how bash removes bashbug?

TERMUX_PKG_RM_AFTER_INSTALL="share/man/man1/bashbug.1 bin/bashbug"

That makes sense to me, feel free to split that out into its own PR.

robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Jun 21, 2025
- For consistency with `bash`: termux#25113 (comment)

https://github.com/termux/termux-packages/blob/6d9084fcd742271e7c3eab852f0a34a6ed167d7e/packages/bash/build.sh#L37

- This kind of command prompts to autosend bug reports to gnu.org.
  - This is not desirable because the gnu.org bug tracker should not be overwhelmed by bugs from an esoteric platform that might not be convenient for upstream developers.
  - It is more efficient for bugs in Termux packages to be reported here, then forwarded to upstream issue trackers if reproducible on a mainstream desktop platform familiar to desktop developers.
  - It is assumed that is why the choice was made for `bash`, and that the same removal should be applied to `gawkbug`.

```
Send bug report to [email protected]? [y/n]
```
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Jun 21, 2025
- For consistency with `bash`: termux#25113 (comment)

https://github.com/termux/termux-packages/blob/6d9084fcd742271e7c3eab852f0a34a6ed167d7e/packages/bash/build.sh#L37

- This kind of command prompts to autosend bug reports to gnu.org.
  - This is not desirable because the gnu.org bug tracker should not be overwhelmed by bugs from an esoteric platform that might not be convenient for upstream developers.
  - It is more efficient for bugs in Termux packages to be reported here, then forwarded to upstream issue trackers if reproducible on a mainstream desktop platform familiar to desktop developers.
  - It is assumed that is why the choice was made for `bash`, and that the same removal should be applied to `gawkbug`.

```
Send bug report to [email protected]? [y/n]
```
robertkirkman added a commit to robertkirkman/termux-packages that referenced this pull request Jun 21, 2025
- For consistency with `bash`: termux#25113 (comment)

https://github.com/termux/termux-packages/blob/6d9084fcd742271e7c3eab852f0a34a6ed167d7e/packages/bash/build.sh#L37

- This kind of command prompts to autosend bug reports to gnu.org.
  - This is not desirable because the gnu.org bug tracker should not be overwhelmed by bugs from an esoteric platform that might not be convenient for upstream developers.
  - It is more efficient for bugs in Termux packages to be reported here, then forwarded to upstream issue trackers if reproducible on a mainstream desktop platform familiar to desktop developers.
  - It is assumed that is why the choice was made for `bash`, and that the same removal should be applied to `gawkbug`.

```
Send bug report to [email protected]? [y/n]
```

- Remove references to `igawk`, which no longer seems to exist

- Specify removal of `gawk-${TERMUX_PKG_VERSION}` explicitly instead of `gawk-*`
TomJo2000 added 23 commits June 30, 2025 03:39
- `cat` is a last resort `pager`
 - Clean up shellcheck warnings, mostly by quoting everything
 - Align build scripts more closely
 - Don't drop images, icons and tutorials from `emacs` package
- These 3 are tied together since the `ex`, `view`, `vim` `vimdiff`
  and `vimtutor` groups require changes in `vim`/`vim-gtk`'s package
  layouts.
- Also stop dropping so many files from the `vim` package,
  we already ship `man1/evim.1`, `rvim`, `rview`, `ex`
  and the icons in `vim-gtk`
@TomJo2000 TomJo2000 force-pushed the update-alternatives-fixes branch from 7a6c30d to 5e0781c Compare June 30, 2025 01:40
@TomJo2000
Copy link
Member Author

TomJo2000 commented Jun 30, 2025

I'd like to get this merged ahead of Vim 9.1.1500 so I don't have to rebase this branch again.
(For context, Vim is currently at 9.1.1497 and since every patch gets released as a tag we have 3 patches until that, which is probably less than a day.)

@TomJo2000 TomJo2000 merged commit b6ca26d into termux:master Jun 30, 2025
11 checks passed
@TomJo2000 TomJo2000 deleted the update-alternatives-fixes branch June 30, 2025 02:10
@TomJo2000
Copy link
Member Author

I missed a couple typos.
Working on it.

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.

less v command defaults to vi which may not be installed.
2 participants