Package: dash
Version: 0.5.7-4+b1
Severity: normal
Tags: upstream patch

Dear Maintainer,

Dash doesn't notice when a format string has digits following a * width
specifier.

    $ printf "%*0s" 1 2
    %10s

The output depends on the runtime library.

I made a quick patch that seems to handle this case, but I haven't checked it
thoroughly.



-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (990, 'testing'), (10, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dash depends on:
ii  debianutils  4.4+b1
ii  dpkg         1.17.24
ii  libc6        2.19-15

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true

*** /home/ptbrown/Documents/src/dash-0.5.8/bug-printf-format.diff
--- src/bltin/printf.c.orig     2015-03-02 23:06:37.574684472 -0500
+++ src/bltin/printf.c  2015-03-02 23:10:09.167733706 -0500
@@ -131,17 +131,20 @@

                        /* skip to field width */
                        fmt += strspn(fmt, SKIP1);
-                       if (*fmt == '*')
+                       if (*fmt == '*') {
                                *param++ = getintmax();
-
-                       /* skip to possible '.', get following precision */
-                       fmt += strspn(fmt, SKIP2);
-                       if (*fmt == '.')
                                ++fmt;
-                       if (*fmt == '*')
-                               *param++ = getintmax();
-
-                       fmt += strspn(fmt, SKIP2);
+                       } else
+                           /* skip to possible '.', get following precision */
+                           fmt += strspn(fmt, SKIP2);
+                       if (*fmt == '.') {
+                               ++fmt;
+                               if (*fmt == '*') {
+                                       *param++ = getintmax();
+                                       ++fmt;
+                               } else
+                                   fmt += strspn(fmt, SKIP2);
+                       }


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to