FreeBSD Bugzilla – Attachment 195131 Details for
Bug 229641
/usr/bin/printf (so also internal printf in sh) ignores width and precision in %b format
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Take 2
printf-bfix.diff (text/plain), 2.29 KB, created by
Pedro F. Giffuni
on 2018-07-14 21:57:51 UTC
(
hide
)
Description:
Take 2
Filename:
MIME Type:
Creator:
Pedro F. Giffuni
Created:
2018-07-14 21:57:51 UTC
Size:
2.29 KB
patch
obsolete
>Index: usr.bin/printf/printf.c >=================================================================== >--- usr.bin/printf/printf.c (revision 336296) >+++ usr.bin/printf/printf.c (working copy) >@@ -1,6 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-3-Clause > * >+ * Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> > * Copyright 2014 Garrett D'Amore <garrett@damore.org> > * Copyright 2010 Nexenta Systems, Inc. All rights reserved. > * Copyright (c) 1989, 1993 >@@ -375,16 +376,19 @@ > char *p; > int getout; > >- p = strdup(getstr()); >- if (p == NULL) { >+ /* Convert "b" to "s" for output. */ >+ start[strlen(start) - 1] = 's'; >+ if ((p = strdup(getstr())) == NULL) { > warnx("%s", strerror(ENOMEM)); > return (NULL); > } > getout = escape(p, 0, &len); >- fputs(p, stdout); >+ PF(start, p); >+ > free(p); >+ /* Restore format for next loop. */ > if (getout) >- return (end_fmt); >+ exit(*rval); > break; > } > case 'c': { >Index: usr.bin/printf/tests/Makefile >=================================================================== >--- usr.bin/printf/tests/Makefile (revision 336296) >+++ usr.bin/printf/tests/Makefile (working copy) >@@ -5,6 +5,7 @@ > TAP_TESTS_SH= legacy_test > > ${PACKAGE}FILES+= regress.b.out >+${PACKAGE}FILES+= regress.bwidth.out > ${PACKAGE}FILES+= regress.d.out > ${PACKAGE}FILES+= regress.f.out > ${PACKAGE}FILES+= regress.l1.out >Index: usr.bin/printf/tests/regress.bwidth.out >=================================================================== >--- usr.bin/printf/tests/regress.bwidth.out (nonexistent) >+++ usr.bin/printf/tests/regress.bwidth.out (working copy) >@@ -0,0 +1 @@ >+ a >Index: usr.bin/printf/tests/regress.sh >=================================================================== >--- usr.bin/printf/tests/regress.sh (revision 336296) >+++ usr.bin/printf/tests/regress.sh (working copy) >@@ -2,7 +2,7 @@ > > REGRESSION_START($1) > >-echo '1..23' >+echo '1..24' > > REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"') > REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123') >@@ -27,5 +27,6 @@ > REGRESSION_TEST(`missingpos1', `printf "%1\$*2\$.*s" 1 1 1 2>&1') > REGRESSION_TEST(`missingpos1', `printf "%*1\$.*2\$s" 1 1 1 2>&1') > REGRESSION_TEST(`missingpos1', `printf "%1\$*.*2\$s" 1 1 1 2>&1') >+REGRESSION_TEST(`bwidth', `printf "%8.2b" "a\nb\n"') > > REGRESSION_END()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229641
:
195011
|
195012
| 195131