bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "printf %d ''" should diagnose the empty string


From: Chet Ramey
Subject: Re: "printf %d ''" should diagnose the empty string
Date: Fri, 22 Nov 2024 11:50:23 -0500
User-agent: Mozilla Thunderbird

On 11/22/24 6:55 AM, Martin D Kealey wrote:

For me, the most *logical* way to write zero is as the empty string, even
if that's not the *customary* way to write it. Feel free to disagree, but
be aware we're talking about opinions, not facts, and there are cogent
reasoned arguments to be made both ways.

You're literally the only one making this argument. It is, indeed, your
opinion, and you seem to be soloing it.


Where?


Who cares? They exist, they work, and we should not break them.

Color me skeptical.

The fact that they're hard to find - and audit - is MORE reason not to
break them, not less. Even if it turns out that no scripts currently in use
actually rely on this feature, having to audit every script to be sure of
this would be an unreasonable impost.

You're making another argument against fixing bugs. I'm not going to treat
it any better than the last one.


If you mean "prove that they exist", then:

    1. I have numerous examples right here on my laptop, and also
    2. other places I can't tell you about because of NDAs and/or my feeble
    human memory; but

So your scripts, then.

    3. scripts that I wrote 17+ years ago were still running at numerous
    clients when I last checked 7 years ago; I'm sure they will still be
    running at *some* clients, even though I'm no longer paid to support
    them.
    4. And since I often do a non-trivial amount of numerical calculation in
    my scripts, some significant portion of those will rely on this behaviour.

And these scripts can't stand a warning message? Because unless you're
running with -e enabled -- which is a bad idea in itself, but that's
a topic for another time -- that's all that's going to change.


Admittedly I'm a sample size of one, but this is one of those idioms that
is so obvious and so useful (when considering certain kinds of problems)
that I VERY much doubt I'm the only person ever to have made use of it.

I don't doubt that there are scripts out there that inadvertently do this,
by passing quoted unset variables as printf arguments, but I very much
doubt that the practice of writing 0 as '' in an argument to printf is
much used.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]