On 07/04/2026 06:40, Collin Funk wrote:
All looks good to me. I pushed it with those changes [1].

Great thanks.
I pushed a further test tweak to handle
splice(/dev/zero) returning EINVAL on Linux kernel 5.10

BTW I'm still thinking about yes -z to efficiently generate zeros,
as the splicing from /dev/zero isn't that fast in comparison:

   $ timeout 2 src/cat /dev/zero | pv -r > /dev/null
   [5.50GiB/s]

   $ timeout 2 src/yes | pv -r > /dev/null
   [31.1GiB/s]

What do you think of the more general --separator (-s) option?

I was thinking you could get the behavior of 'yes -z' by using:

     $ yes --separator '' ''

But it would also allow you to use strings instead of a newline
character.

If we did want that generality, it's a bit more complicated
as yes(1) has both an arg separator and line terminator.
The --separator wording would be confusing there,
so would probably have to be --line-separator or --terminator.

Also since arguments can't contain NUL characters,
and an empty separator is a useful concept (consider yes 10),
it would be good to distinguish empty and NUL.

  -t,--terminator ''   => no line separator
  -t,--terminator '\0' => NUL line separator
  -t,--terminator '  ' => multiple chars supported

the same could be done for the args separator.
I'm not suggesting -s is required, but this would be the
natural way to do that given the above.

  -s,--separator ''   => no arg separator
  -s,--separator '\0' => NUL arg separator
  -s,--separator '  ' => multiple chars supported

So to output NULs you would then have:

  yes -t '\0' ''

The main advantage over `yes -z ''` is the ability
to specify an empty line separator.
Note we'd have to disallow `yes -t '' ''` as meaningless.

So options are at this stage:

  yes -t '\0' ''
  yes -z ''
  cat /dev/zero

I'm 60:40 for `yes -t` given the extra flexibility/performance.

cheers,
Padraig

Reply via email to