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

cut: -d= works differently than gnu-cut #2424

Closed
SuperSandro2000 opened this issue Jun 17, 2021 · 5 comments · Fixed by #2428
Closed

cut: -d= works differently than gnu-cut #2424

SuperSandro2000 opened this issue Jun 17, 2021 · 5 comments · Fixed by #2428

Comments

@SuperSandro2000
Copy link
Contributor

gnu-cat:

echo "--libdir=./out/lib" | cut -f2 -d=
./out/lib

uutils-cat:

echo "--libdir=./out/lib" | result/bin/cut -f2 -d"="
--libdir=./out/lib

Noticed while building rustc.

@jhscheer
Copy link
Contributor

This seems to be a limitation of the parsing done by the clap crate.
In their docs it says:

NOTE: values for arguments may be specified in any of the following methods
Using a space such as -o value or --option value
Using an equals and no space such as -o=value or --option=value
Use a short and no space such as -ovalue

If the method is a short and no space, the value can't be =.
Right now, to use = as delimiter for cut, there has to be a space, i.e. only -d = and --delimiter = works.

@SuperSandro2000
Copy link
Contributor Author

Isn't there an effort to migrate away from clap?

I can't and don't really want to change the installer script for rust to be compatible with uutils-coreutils. https://github.com/rust-lang/rust-installer/blob/master/install-template.sh#L179

@tertsdiepraam
Copy link
Member

Quite the opposite 😄 We've been moving utils to clap. I agree however that we should support this. I see two paths forward (1) we work around clap or (2) we contribute a new setting to clap that disables this behaviour. I would prefer the second option, but we'll have to wait for clap 3 to be able to use it.

@jhscheer
Copy link
Contributor

I prefer (1).
I briefly glanced over clap 3beta and the clap discussions and didn't see this issue mentioned.
Also there's no clear ETA when clap 3 will be stable, it could very well take another 6-12 months.

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Jun 18, 2021

Agreed, my preference was more "in an ideal situation". I'm not quite sure how to work around it in this case, though, but it's probably possible.

Might still be worth contributing to clap in the long term. They seem to welcome PR's even if they weren't discussed at length. I contributed InferLongArgs this way.

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 a pull request may close this issue.

3 participants