Skip to content

Comments

[: install test as [ as well#2465

Merged
sylvestre merged 3 commits intouutils:masterfrom
miDeb:install-test
Jul 7, 2021
Merged

[: install test as [ as well#2465
sylvestre merged 3 commits intouutils:masterfrom
miDeb:install-test

Conversation

@miDeb
Copy link
Contributor

@miDeb miDeb commented Jun 28, 2021

Closes #2420.

This installs test as [ as well. When test is called with a binary name that ends with [, it changes its behavior a bit.
I would rather add [ as its own utility instead of changing the behavior of test based on its binary name,
but I ran into problems trying to do that because [ is not a valid crate/feature name. Working around it in build.rs and in GNUmakefile adds complexity and feels easy to get wrong... In any case we can't convince cargo to create a binary called [, which we can't work around if uutils is installed via cargo install.

There are plans for cargo to support creating arbitrarily named binaries, which would mean we'd only have to work around the restriction for the feature name.

Maybe we can solve this problem in some other way?

miDeb added 2 commits June 29, 2021 00:27
This makes [ work even when installed with a custom prefix, e.g. as uu-[.
@jhscheer
Copy link
Contributor

I would rather add [ as its own utility instead of changing the behavior of test based on its binary name,
but I ran into problems trying to do that because [ is not a valid crate/feature name.

I think your approach as it is right now is a valid workaround.

The manpage speaks of another subtle difference:

NOTE: [ honors the --help and --version options, but test does not. test treats each of those as it treats any other nonempty STRING.

@miDeb
Copy link
Contributor Author

miDeb commented Jun 29, 2021

NOTE: [ honors the --help and --version options, but test does not. test treats each of those as it treats any other nonempty STRING.

Thanks for pointing this out! Are we allowed to copy the help text from GNU, or do we have to come up with our own?

I copied the help text verbatim from GNU, I hope that's ok.
@sylvestre sylvestre merged commit df683f8 into uutils:master Jul 7, 2021
@SuperSandro2000
Copy link
Contributor

SuperSandro2000 commented Jul 9, 2021

I am on 2177b8d and the alias is not installed for me.

Fixed in #2491

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.

make with MULTICALL is missing symlink from test to [

4 participants