Bug 250492 - chown: argument delimiter (--) isn't accepted
Summary: chown: argument delimiter (--) isn't accepted
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: 12.1-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-standards (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-20 18:40 UTC by David Ramirez Salmeron
Modified: 2020-10-20 18:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Ramirez Salmeron 2020-10-20 18:40:29 UTC
chown doesn't accept -- to indicate the end of options. For example:

# ls -1
1.a
2.a
3.a

# chown root:wheel -- *.a
chown: --: No such file or directory

The error about -- not existing wasn't expected, as it just means that subsequent arguments aren't options.

I haven't found any other utility which doesn't accept this, so I'm not sure if this is a bug or if it's intentional.
Comment 1 andrew 2020-10-20 18:47:30 UTC
This is not a bug; you're misunderstanding where the -- goes.

-- is used to separate options from positional arguments, but the username or username:groupname parameter to chown is a positional argument and not an option, so it would be

chown -- root:wheel *.a

(you would need this if, for example, the username might start with a - character)

After a positional argument has appeared, then -- is no longer special and becomes just another positional argument, so in your example it's just another file name.