uutils / uutils/coreutils

Incorrect interpretation of double dash

Open
#7,737 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - All
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

This issue is about -- (perhaps also called: double minus, minus minus, double dash, double hyphen, or something like that, I don't actually know).

At first glance, -- is just a separator between options and arguments – and usually that is correct!

However, it seems that if supplied as argument to an option, then GNU and clap differ:

  • GNU says it is NOT a separator, and instead a regular argument.
  • clap says it IS a separator, and complains about the missing argument.
$ find -maxdepth 1 -name 'README*' -print0 > ./--
$ hd ./--
00000000  2e 2f 52 45 41 44 4d 45  2e 70 61 63 6b 61 67 65  |./README.package|
00000010  2e 6d 64 00 2e 2f 52 45  41 44 4d 45 2e 6d 64 00  |.md../README.md.|
00000020
$ ~/workspace/gnu/src/du --files0-from --
4	./README.package.md
8	./README.md
$ cargo +stable --quiet run du --files0-from --
error: a value is required for '--files0-from <FILE>' but none was supplied

For more information, try '--help'.
[$? = 1]

This probably affects nearly all utils (and not just du). Since this is unfixable in clap, this is yet another point in favor of https://github.com/uutils/coreutils/issues/4254.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by reproducing the provided GNU du and cargo +stable --quiet run du --files0-from -- commands, then inspect how clap parses --files0-from and compare the scope with uutils/coreutils issue #4254. Done means establishing whether this repository can address the discrepancy or documenting why it belongs elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.