bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf %*s bug


From: Jim Meyering
Subject: Re: printf %*s bug
Date: Sat, 18 Aug 2001 09:59:21 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.105

Andrew Schepler <address@hidden> wrote:
> printf(1) of the shell-utils stuffs has a bug that appears when a
> conversion code fails to convert a number argument with '*' and then
> attempts to print a string anyway.
>
> Examples:
> printf %*s a foo
> printf %.*s text asdf
>
> Both of these will typically print garbage to the terminal, sometimes
> munging things up to require a 'reset'. They will occasionally result in
> the death of their parent shell.

Thanks for the report!
That is a bug in bash's builtin printf function, not in the
one from sh-utils.

To use the version from the sh-utils package, you can invoke it like this:

  $ `which printf` '%*s\n' a foo
  /usr/bin/printf: a: expected a numeric value
  foo
  [Exit 1]

Here's what happens when I use bash's builtin printf:

  $ echo $BASH_VERSION
  2.05.0(1)-release
  $ printf %*s a foo
  bash: printf: a: invalid number
  Segmentation fault
  [Exit 139 (SIGSEGV)]



Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H  -D_FILE_OFFSET_BITS=64  -I. 
-I/usr/include -I/home/debian/src/bash/bash-2.05 
-I/home/debian/src/bash/bash-2.05/include -I/home/debian/src/bash/bash-2.05/lib 
-I/usr/include -g -O2
uname output: Linux seche 2.4.4 #2 SMP Sat May 5 12:04:23 CEST 2001 i686 unknown
Machine Type: i386-pc-linux-gnu

Bash Version: 2.05
Patch Level: 0
Release Status: release
...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]