Skip to content

Conversation

@robertkirkman
Copy link
Member

@robertkirkman robertkirkman commented Jun 23, 2025

  • Continuation of fix(scripts/login.in): don't canonicalize symlink value #179, particularly these topics from there:

  • Contains things that were proposed there, but that it was decided to separate out into another PR for organization and easier review

  • Replaces backtick command substitution syntax with dollar symbol and parentheses command substitution syntax in shell scripts

  • Places double quote symbols around all string (non-numerical) variable references that aren't possibly-empty references in the argument lists of command invocations

    • (placing double quote symbols around a possibly-empty variable in a command invocation is a case where the double quote symbols would cause an error to happen)
  • Places double quote symbols around all instances of @TERMUX_PREFIX@ and other replaced strings in .sh.in files

  • Remove unused function hostname() from pkg

  • Remove unused variable PREFIX from termux-restore

  • Unify and clarify instances of login-related error message in chsh

Copy link
Member

@TomJo2000 TomJo2000 left a comment

Choose a reason for hiding this comment

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

I've been using this branch for my Apt 3.x testing and it is working as expected.

@agnostic-apollo
Copy link
Member

Do not replace space indent with tab for entire script (termux-change-repo, termux-open), spaces should be preferred anyways and we shouldn't be going the other way.

Do not join local declarations, they seem like change for the sake of change.

Rest is fine.

@robertkirkman
Copy link
Member Author

robertkirkman commented Nov 29, 2025

Do not replace space indent with tab for entire script (termux-change-repo, termux-open), spaces should be preferred anyways and we shouldn't be going the other way.

I see, I will remove all those. I thought that everything in Termux was supposed to have only tabs except for specific things I saw you mention before like the termux-packages/scripts/utils/package/termux_package.sh file. I will add termux-tools to the list of things I have seen you mention should have spaces and not tabs.

Do not join local declarations, they seem like change for the sake of change.

I see, I will remove all those. The reason I changed that is because I saw twaik saying to change it in another place, maybe that doesn't apply here or is wrong.

image

@agnostic-apollo
Copy link
Member

Tabs is recommended in contributing guide for termux-packages. However, tabs rendering is not fixed width, and appears different on different devices/applications, and shouldn't be used for indents, as code and comments formatting gets mangled. Its bit too late to switch from tabs to spaces in termux-packages for existing scripts, but once lot of code gets pulled into libraries, spaces can be used. Even here, I don't think its a good idea to go in the wrong way, and would mess with git line history.

Twaiks comment was about multiple invocations of local while being on the same line. Single line declarations can be good, especially for related variables, but people often split declaration in their code bases as its easier to read, including the variables set from parameters $x. It wouldn't affect performance as such, especially here.

- Continuation of termux#179, particularly these topics from there:
  - termux#179 (review)
  - termux#179 (comment)

- Contains things that were proposed there, but that it was decided to separate out into another PR for organization and easier review

- Replaces backtick command substitution syntax with dollar symbol and parentheses command substitution syntax in shell scripts

- Places double quote symbols around all string (non-numerical) variable references that aren't possibly-empty references in the argument lists of command invocations
  - (placing double quote symbols around a possibly-empty variable in a command invocation is a case where the double quote symbols would cause an error to happen)

- Places double quote symbols around all instances of `@TERMUX_PREFIX@` and other replaced strings in `.sh.in` files

- Remove unused function `hostname()` from `pkg`

- Remove unused variable `PREFIX` from `termux-restore`

- Unify and clarify instances of `login`-related error message in `chsh`
@agnostic-apollo
Copy link
Member

Looks good. Can merge.

Note that termux-backup uses $PREFIX after setting it once with placeholder replacement, termux-restore should ideally do same. But they both use @TERMUX_BASE_DIR@. Not necessary to do though.

@TomJo2000
Copy link
Member

@robertkirkman
Copy link
Member Author

Note that termux-backup uses $PREFIX after setting it once with placeholder replacement, termux-restore should ideally do same. But they both use @TERMUX_BASE_DIR@. Not necessary to do though.

Correct, termux-restore currently sets PREFIX but does not use it, instead using @TERMUX_PREFIX@ again without ever using PREFIX. I found that confusing, so I assumed the best choice was to remove PREFIX from termux-restore. If I should instead change it to remove the second instance of @TERMUX_PREFIX@ and replace it with $PREFIX, let me know.

@agnostic-apollo
Copy link
Member

You would have to do for base dir as well. But leave for now. I remembered I intended to use $TERMUX__PREFIX in future for dynamic variables in all the termux-tools scripts, so would have to make changes anyways.

Tom, that's a bigger mess I don't have time for right now. Just make release based on this.

@robertkirkman
Copy link
Member Author

There are many long explanations of various parts of that PR in its thread, but one thing I would like to call attention to briefly for first-time viewers that I didn't really yet, is that there are two variants of the proposal, the one without the "tstein's idea" commit, and the one with the "tstein's idea" commit, I slightly prefer the one without it, but I assume tstein slightly prefers the one with it, and the "tstein's idea" commit doesn't bother me very much and is overall still pretty similar.

@robertkirkman
Copy link
Member Author

robertkirkman commented Nov 29, 2025

Tom, that's a bigger mess I don't have time for right now. Just make release based on this.

I agree, that PR significantly changes the behavior of pkg install and should be considered in isolation later if ever, not at the same time as other changes.

@agnostic-apollo
Copy link
Member

I haven't looked at yours, but even I was working on other ideas, so a lot to look into.

@TomJo2000
Copy link
Member

Merging this now then.

@TomJo2000 TomJo2000 merged commit 9806c79 into termux:master Nov 29, 2025
@TomJo2000
Copy link
Member

I'll make a tag and release in a bit, I'll also go ahead and publish a release for 1.47.1, which never got one.

@agnostic-apollo
Copy link
Member

Thanks. Make sure to bump version before releasing.

AC_INIT([termux-tools], [1.47.1], [support@termux.dev])

@TomJo2000
Copy link
Member

I knew I was forgetting something, welp mulligan then.

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