Bug 263289 - devfs: /bin/devfs usage
Summary: devfs: /bin/devfs usage
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-15 00:29 UTC by Yuichiro NAITO
Modified: 2023-02-03 16:05 UTC (History)
4 users (show)

See Also:
grahamperrin: maintainer-feedback? (ngie)
zlei: mfc-stable13+
zlei: mfc-stable12+


Attachments
devfs patch (388 bytes, patch)
2022-04-16 03:24 UTC, Yuichiro NAITO
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuichiro NAITO 2022-04-15 00:29:54 UTC
When I type `devfs -s 1 rule show`, it fails by `illegal option -- s`.
Because I see devfs usage as follows.

```
usage:  devfs [-m mount-point] [-s ruleset] rule ...
        devfs [-m mount-point] ruleset ...
```

`devfs rule -s 1 show` succeeds and shows rules of ruleset 1.
Is it mistake of usage?
Comment 1 Zhenlei Huang freebsd_committer freebsd_triage 2022-04-15 08:28:16 UTC
(In reply to Yuichiro NAITO from comment #0)
See devfs(8), 
```
   Rule Manipulation
     Rule manipulation commands follow the rule keyword.  The following flags
     are common to all of the rule manipulation commands:

     -s ruleset       Operate on the ruleset with the number ruleset.  If this
                      is not specified, the commands operate on the ruleset
                      currently associated with the specified mount-point.

     The following commands are recognized:
...
```

The `-s` is rule manipulation command, and it should follow the rule keyword. So the correct usage should be `devfs rule -s 1 show` .
Comment 2 Yuichiro NAITO 2022-04-16 03:24:19 UTC
Indeed.
The manual says that `-s` option is a sub option of rule keyword and devfs(8) works as well.
So, I'm happy if the attached patch that fix usage message is committed.
Comment 3 Yuichiro NAITO 2022-04-16 03:24:54 UTC
Created attachment 233244 [details]
devfs patch
Comment 4 Zhenlei Huang freebsd_committer freebsd_triage 2022-04-16 05:15:04 UTC
The patch LGTM, submitted to Phabricator: https://reviews.freebsd.org/D34934
Comment 5 Hiroki Sato freebsd_committer freebsd_triage 2022-04-22 10:30:50 UTC
Take
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-04-30 18:01:18 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f9f42a709b2b3f8c8d3de517f301d4ccb33e7b16

commit f9f42a709b2b3f8c8d3de517f301d4ccb33e7b16
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2022-04-30 17:54:43 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2022-04-30 18:00:11 +0000

    sbin/devfs: Correct usage

    The -s applies to rule keyword only and it follows the rule keyword.

    MFC after:      1 week
    PR: [[https://bugs.freebsd.org/bugzilla/show_bug.cgi?id= 263289|263289]]
    Submitted by: Yuichiro NAITO <naito.yuichiro@gmail.com>
    Fixes: c3e412c08333 sbin/devfs: clarify usage
    Reviewed by: ngie
    Differential Revision: https://reviews.freebsd.org/D34934

 sbin/devfs/devfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 Yuichiro NAITO 2022-05-09 23:13:17 UTC
Thanks for the commit!
I could see that devfs usage has been changed.
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-02-03 15:58:16 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=66b882078973d6e2fce77f976e6c073d0786b3ca

commit 66b882078973d6e2fce77f976e6c073d0786b3ca
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2022-04-30 17:54:43 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-02-03 15:47:41 +0000

    sbin/devfs: Correct usage

    The -s applies to rule keyword only and it follows the rule keyword.

    PR:             263289
    Submitted by:   Yuichiro NAITO <naito.yuichiro@gmail.com>
    Reviewed by:    ngie
    Fixes:          c3e412c08333 sbin/devfs: clarify usage
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D34934

    (cherry picked from commit f9f42a709b2b3f8c8d3de517f301d4ccb33e7b16)

 sbin/devfs/devfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-02-03 16:01:18 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ac3223a57e119e9e4b6ac055b30b840045acfda1

commit ac3223a57e119e9e4b6ac055b30b840045acfda1
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2022-04-30 17:54:43 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-02-03 15:59:18 +0000

    sbin/devfs: Correct usage

    The -s applies to rule keyword only and it follows the rule keyword.

    PR:             263289
    Submitted by:   Yuichiro NAITO <naito.yuichiro@gmail.com>
    Reviewed by:    ngie
    Fixes:          c3e412c08333 sbin/devfs: clarify usage
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D34934

    (cherry picked from commit f9f42a709b2b3f8c8d3de517f301d4ccb33e7b16)
    (cherry picked from commit 66b882078973d6e2fce77f976e6c073d0786b3ca)

 sbin/devfs/devfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 10 Zhenlei Huang freebsd_committer freebsd_triage 2023-02-03 16:05:59 UTC
Thanks for the report! Close as fixed.