mailing list of musl libc
 help / color / mirror / code / Atom feed
* libc-test octal corner cases
@ 2018-01-31 15:42 Rich Felker
  2018-02-07 21:24 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Felker @ 2018-01-31 15:42 UTC (permalink / raw)
  To: musl

[-- 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 }
 };
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libc-test octal corner cases
  2018-01-31 15:42 libc-test octal corner cases Rich Felker
@ 2018-02-07 21:24 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2018-02-07 21:24 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2018-01-31 10:42:57 -0500]:
> 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.

applied.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-07 21:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-31 15:42 libc-test octal corner cases Rich Felker
2018-02-07 21:24 ` Szabolcs Nagy

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).