| Summary: | "seq -f string" repeats strings wrong times | ||
|---|---|---|---|
| Product: | Base System | Reporter: | y |
| Component: | bin | Assignee: | Conrad Meyer <cem> |
| Status: | Closed FIXED | ||
| Severity: | Affects Many People | ||
| Priority: | --- | ||
| Version: | 12.0-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
y
2019-03-07 07:03:42 UTC
Separately, seq 0 is broken — prints 1\n0. Should be empty. (In reply to Conrad Meyer from comment #1) > Separately, seq 0 is broken — prints 1\n0. Should be empty. Well, maybe broken is wrong. It is inconsistent with GNU seq, due to this documented behavior in seq(1): > When first is larger than last, the default incr is -1. In GNU seq, default incr is always 1. Ok, this is because the check for a final value past 'end' assumes that the format string will include a representation of the iterated value. Given '-f foo' does not contain '%g' or anything like that, the check is broken. Thanks for the report! A commit references this bug: Author: cem Date: Thu Mar 7 18:24:17 UTC 2019 New revision: 344891 URL: https://svnweb.freebsd.org/changeset/base/344891 Log: seq(1): Require user-provided format strings to contain a conversion This matches GNU seq, for example. For users that are looking for similar functionality, 'jot -b foo N' will print 'foo' N times. See jot(1). PR: 236347 Reported by: <y AT maya.st> Sponsored by: Dell EMC Isilon Changes: head/usr.bin/seq/seq.c head/usr.bin/seq/tests/seq_test.sh |