[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
builtin printf %b "\0000" emits no data
From: |
llattanz |
Subject: |
builtin printf %b "\0000" emits no data |
Date: |
Thu, 17 Jun 2004 17:35:40 -0700 (PDT) |
Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin8.0
Compiler: gcc
Compilation CFLAGS: -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch
i386 -arch ppc -pipe -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc'
-DCONF_OSTYPE='darwin8.0' -DCONF_MACHTYPE='powerpc-apple-darwin8.0'
-DCONF_VENDOR='apple' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I.
-I/SourceCache/bash/bash-30/bash -I/SourceCache/bash/bash-30/bash/include
-I/SourceCache/bash/bash-30/bash/lib -arch i386 -arch ppc -g -Os -pipe
-no-cpp-precomp -arch i386 -arch ppc -pipe
uname output: Darwin stderr.apple.com 8.0.0b1 Darwin Kernel Version 8.0.0b1:
Mon May 10 23:45:14 PDT 2004; root:xnu/xnu-600.3.obj~4/RELEASE_PPC Power
Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
printf.def:printstr will skip output if *string == '\0' but
that is valid data for printf %b "\0000"
Repeat-By:
/usr/bin/printf %b "\0000" | wc -c
1
bash -c 'printf %b "\0000"' | wc -c
0
after fix wc sees 1 byte of input
Fix:
Index: printf.def
===================================================================
RCS file: /cvs/root/bash/bash/builtins/printf.def,v
retrieving revision 1.1.1.5
diff -u -d -b -w -r1.1.1.5 printf.def
--- printf.def 2003/04/05 08:00:28 1.1.1.5
+++ printf.def 2004/06/18 00:27:18
@@ -443,7 +443,7 @@
int padlen, nc, ljust, i;
int fw, pr; /* fieldwidth and precision */
- if (string == 0 || *string == '\0')
+ if (string == 0) /* Process even with *string == '\0', valid %b
data */
return;
#if 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- builtin printf %b "\0000" emits no data,
llattanz <=