bug-bash
[Top][All Lists]
Advanced

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

Re: %q with truncating size loses safeness of %q


From: Robert Elz
Subject: Re: %q with truncating size loses safeness of %q
Date: Mon, 20 Apr 2020 20:44:54 +0700

    Date:        Mon, 20 Apr 2020 09:03:39 -0400
    From:        Chet Ramey <address@hidden>
    Message-ID:  <address@hidden>

  | I'm referring to the specification of %b that I quoted in another message,

I didn't see that (and I certainly didn't comment on it wrt rationality).

  | which uses the precision after the argument is expanded.

Yes, %b is a hard case, neither way makes a lot of sense to use the
precision, certainly truncating the input string half way through an
escape sequence would be absurd, so if the precision needs to do
anything at all, having it apply to the expanded string makes more
sense than having it apply to the input.  Using the precision with a
%b expansion probably indicates a user who isn't really thinking though.

%q however is different, there applying the precision to the quoted
string is ludicrous (but easy to implement), whereas applying it to
the input can be useful (but means more work).

kre




reply via email to

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