Page MenuHomeFreeBSD

yes: Completely overengineer
AcceptedPublic

Authored by des on Mon, Mar 2, 3:55 PM.
Tags
None
Referenced Files
F146698573: D55617.id173065.diff
Wed, Mar 4, 7:49 PM
F146692617: D55617.id173017.diff
Wed, Mar 4, 6:40 PM
F146684907: D55617.id.diff
Wed, Mar 4, 5:17 PM
F146649221: D55617.id173065.diff
Wed, Mar 4, 10:16 AM
F146645233: D55617.id173062.diff
Wed, Mar 4, 9:25 AM
F146645200: D55617.id173062.diff
Wed, Mar 4, 9:25 AM
F146613547: D55617.id173016.diff
Wed, Mar 4, 2:53 AM
F146613532: D55617.id173056.diff
Wed, Mar 4, 2:53 AM

Details

Reviewers
allanjude
kevans
Group Reviewers
Klara
Summary

If we're going to overengineer this, we may as well go all the way.
Well, most of the way. I didn't feel like adding long options.

  • Add a getopt() loop and a usage message.
  • If multiple arguments are given, concatenate them into a space- separated list like GNU coreutils does.
  • When duplicating the expletive, do so exponentially.
  • Most importantly, don't modify the memory that argv points to.

This will now behave mostly like GNU coreutils, except for the absence
of the --help and --version options.

MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71134
Build 68017: arc lint + arc unit

Event Timeline

des requested review of this revision.Mon, Mar 2, 3:55 PM
des added a reviewer: gahr.

This changes yes -foo from emitting -foo to an error. Do we really want that for the sake of compatibility with GNU's version?

gahr requested changes to this revision.Mon, Mar 2, 10:06 PM
This revision now requires changes to proceed.Mon, Mar 2, 10:06 PM
usr.bin/yes/yes.c
95

Leftover?

This changes yes -foo from emitting -foo to an error. Do we really want that for the sake of compatibility with GNU's version?

That's not just “compatibility with GNU”, it's consistency with our other command-line utilities (except df and echo, which are special for historical reasons).

usr.bin/yes/yes.c
95

Yes. I thought I'd removed it...

really remove debugging printf

des marked an inline comment as done.Tue, Mar 3, 12:00 PM
In D55617#1272905, @des wrote:

This changes yes -foo from emitting -foo to an error. Do we really want that for the sake of compatibility with GNU's version?

That's not just “compatibility with GNU”, it's consistency with our other command-line utilities (except df and echo, which are special for historical reasons).

Well, it looks like yes is special for historical reasons too.. I don't see a value in this change, and I see a diminished functionality. But I won't stand in the way if you find consensus.

des added a subscriber: gahr.

Well, it looks like yes is special for historical reasons too.. I don't see a value in this change, and I see a diminished functionality. But I won't stand in the way if you find consensus.

df and echo are documented (and required) to deviate from the standard command-line conventions; yes is not.

rename MINBUF to OPTBUF and explain

This revision is now accepted and ready to land.Tue, Mar 3, 5:26 PM
kevans added a subscriber: kevans.

Happy with this as long as we tag the getopt-related incompatibility for relnotes. I suspect it's not a problem in practice, but we should still call it out.