Page MenuHomeFreeBSD

yes: Completely overengineer
Needs ReviewPublic

Authored by des on Mon, Mar 2, 3:55 PM.
Tags
None
Referenced Files
F147190884: D55617.id173168.diff
Sun, Mar 8, 11:53 PM
F147177003: D55617.id173062.diff
Sun, Mar 8, 9:10 PM
Unknown Object (File)
Sat, Mar 7, 2:30 PM
Unknown Object (File)
Sat, Mar 7, 8:38 AM
Unknown Object (File)
Fri, Mar 6, 9:40 PM
Unknown Object (File)
Fri, Mar 6, 11:47 AM
Unknown Object (File)
Fri, Mar 6, 11:27 AM
Unknown Object (File)
Fri, Mar 6, 8:01 AM

Details

Reviewers
allanjude
kevans
gahr
Group Reviewers
Klara
Summary

If we're going to overengineer this, we may as well go all the way.

  • 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.

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 71155
Build 68038: 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
105

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
105

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.

This revision now requires review to proceed.Thu, Mar 5, 8:25 AM

I moved the getopt() loop to D55664 so this can be merged without breaking compatibility.

des edited the summary of this revision. (Show Details)