Skip to content

numfmt: restore the number_str the build needs, and sort: capture -z output as bytes - #229

Merged
JalonSolov merged 3 commits into
vlang:mainfrom
metif12:fix/sort-z-and-numfmt
Oct 6, 2026
Merged

JalonSolov merged 3 commits into
vlang:mainfrom
metif12:fix/sort-z-and-numfmt

Conversation

@metif12

@metif12 metif12 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Two regressions on main, both found by running the suite after the last batch of merges.

numfmt does not compile

number_str is called at numfmt.v:74 and :169 but is not defined anywhere in
the file:

src/numfmt/numfmt.v:74:26: error: unknown function: number_str
src/numfmt/numfmt.v:169:9: error: unknown function: number_str

The #224 merge removed the definition at :99. The other copy that was in the file
came from a branch that is not on main, so main was left with no definition at all.
This restores the one with the GNU parity comment, which is the one that was there
before #224.

sort's -z test failed for a different reason than it looked

sort -z is correct. On b\0c\nd\0e\n it writes b\0c\nd\0e\n\0, nine bytes,
matching GNU 9.4:

$ sort -z od.txt | od -c
0000000   b  \0   c  \n   d  \0   e  \n  \0

The test read the output through os.execute, which hands the captured bytes over as
a string, and the NUL bytes do not survive that: os.execute reported six bytes
with the NULs gone, which is why the assertion saw bc where b\0c was expected.
The test now captures to a file and reads it back with os.read_bytes, so the
comparison is on the real bytes.

Suite

41 passed, 3 failed, 8 skipped, of 52

The three that fail — cksum, shuf, sort — all read standard input, which the
Windows build of this V does not put in binary mode. That is
set_stream_binary_mode in vlib/builtin/builtin_windows.c.v, a change in the V
compiler rather than in this repository, so it is not fixed here.

…output as bytes

Two regressions on main, both found by running the suite.

numfmt did not compile: number_str is called at numfmt.v:74 and :169 but not
defined anywhere. The vlang#224 merge removed the definition at :99, and the other copy
that was in the file came from a branch that is not on main, so main was left with
no definition at all. Restored the one with the GNU parity comment, which is the
one that was there before.

sort's -z test failed for a different reason than it looked. sort -z is correct:
on b\0c\nd\0e\n it writes b\0c\nd\0e\n\0, nine bytes, matching GNU. The test read the
output through os.execute, which hands the captured bytes over as a string, and the
NUL bytes do not survive that: os.execute reported six bytes with the NULs gone.
The test now captures to a file and reads it back with os.read_bytes, so the
comparison is on the real bytes.

Suite after: 41 passed, 3 failed, 8 skipped of 52. The three that fail all read
standard input, which the Windows build of this V does not put in binary mode, and
that is a change in the V compiler rather than in this repository.
csplit and join were merged as vlang#221 and vlang#222 but never marked, and od was merged
as vlang#228. The count was 76 of 109; it is 79.
GNU writes --input-range=LO-HI, and the descriptions in vlang#193 differ from that.
The flag module puts a space between the option name and its argument description,
so this gets --input-range =LO-HI rather than --input-range=LO-HI. The equals sign
is the part that carries the meaning, and the space is a limitation of the flag
module rather than something this repository can change.
@JalonSolov
JalonSolov merged commit 0172893 into vlang:main Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants