On Tue, 7 Jan 2025 14:48:03 +0100 =?utf-8?B?0L3QsNCx?= 
<nabijaczlew...@nabijaczleweli.xyz> wrote:
> Package: coreutils
> Version: 9.4-3
> Version: 9.1-1
> Severity: normal
> 
> Dear Maintainer,
> 
> $ printf '2024\0TODOs\n' | numfmt -d '' --to iec-i
> 2.0Ki

Hi наб,

As far as I know, this tool works with text input, as most Unix tools.
What you introduced is not a text file, per POSIX.1-2024, Volume 1,
Chapter 3, definition 3.387:

        3.387 Text File

        A file that contains characters organized into zero or more
        lines.  The lines do not contain NUL characters and none can
        exceed {LINE_MAX} bytes in length, including the <newline>
        character.  Although POSIX.1-2024 does not distinguish between
        text files and binary files (see the ISO C standard), many
        utilities only produce predictable or meaningful output when
        operating on text files. The standard utilities that have such
        restrictions always specify "text files" in their STDIN or INPUT
        FILES sections.

You could say it's a binary file, although POSIX claims to not
differentiate between text files and binary files (but they do), but
let's agree that a binary file is what POSIX doesn't consider a text
file.  What you're experiencing is "[non] predictable [nor] meaningful
output", in standardese, a.k.a., undefined behavior, I'd say.


Have a lovely New Year!
Alex

> 
> So, '\0TODOs' was removed from the input line.
> 
> Best,

-- 
<https://www.alejandro-colomar.es/>

Attachment: signature.asc
Description: PGP signature

Reply via email to