GNU bug report logs -
#69822
[PATCH] format-spec pads when it should only truncate
Previous Next
Reported by: Adam Porter <adam <at> alphapapa.net>
Date: Sat, 16 Mar 2024 02:30:02 UTC
Severity: normal
Tags: patch
Done: Adam Porter <adam <at> alphapapa.net>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
Please see the attached patch which fixes a bug in `format-spec': that a
format spec like "%>15t", which is intended to limit the width of a
string to 15 characters, would also pad a string less than that length
to be that length.
Please note the test case which the patch essentially disables: it calls
one of the intermediate functions with arguments which I'm not sure it
would be called with in real usage. I added two test cases to cover the
behavior which the patch is intended to fix, and after editing the
`format-spec--do-flags' to pass the new cases, only that one case
failed; so, since I'm not sure whether it indicates an actual bug, I
disabled it.
Perhaps there exists a real-world scenario to which that test would
apply, but such is not encoded as an end-to-end test of `format-spec'
with a spec string, so it's hard to say.
In other words, this patch fixes a real bug and adds test cases for it.
It also causes an existing case to fail, but since I'm not sure whether
that represents a real bug, that case is now disabled.
All other tests in the file still pass.
Thanks,
Adam
[0001-format-spec-do-flags-Don-t-pad-when-just-truncating.patch (text/x-patch, attachment)]
This bug report was last modified 1 year and 56 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.