From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: libc-test octal corner cases
Date: Wed, 31 Jan 2018 10:42:57 -0500 [thread overview]
Message-ID: <20180131154257.GP1627@brightrain.aerifal.cx> (raw)
[-- Attachment #1: Type: text/plain, Size: 380 bytes --]
musl commit b64539ae06aa91a407359238f4e909adb9bfab3d fixed some octal
printing corner cases. I've written some tests to cover the affected
functionality to go in libc-test. I just added them to the existing
snprintf test rather than as a regression test since, despite it being
a bug fix, these fit the general form and I think it makes sense to
have them all in one place.
Rich
[-- Attachment #2: printf-octal.diff --]
[-- Type: text/plain, Size: 606 bytes --]
diff --git a/src/functional/snprintf.c b/src/functional/snprintf.c
index c96f151..70c1118 100644
--- a/src/functional/snprintf.c
+++ b/src/functional/snprintf.c
@@ -60,6 +60,20 @@ static const struct {
{ "%o", 15, "17" },
{ "%#o", 15, "017" },
+ /* octal: corner cases */
+ { "%#o", 0, "0" },
+ { "%#.0o", 0, "0" },
+ { "%#.1o", 0, "0" },
+ { "%#o", 1, "01" },
+ { "%#.0o", 1, "01" },
+ { "%#.1o", 1, "01" },
+ { "%#04o", 1, "0001" },
+ { "%#04.0o", 1, " 01" },
+ { "%#04.1o", 1, " 01" },
+ { "%04o", 1, "0001" },
+ { "%04.0o", 1, " 1" },
+ { "%04.1o", 1, " 1" },
+
{ NULL, 0.0, NULL }
};
next reply other threads:[~2018-01-31 15:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 15:42 Rich Felker [this message]
2018-02-07 21:24 ` Szabolcs Nagy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180131154257.GP1627@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).