Bug#972886: dash: printf %b '\000' # does not produce NUL in output

2020-10-25 Thread Flavio Poletti
Il giorno dom 25 ott 2020 alle ore 20:27 Flavio Poletti 
ha scritto:

> Package: dash
> Version: 0.5.8-2.4
> Severity: normal


It occurred to me that there might be no bug report and still this might
have been solved in more recent versions of the package.

I then got an updated version of Debian 10 with dash 0.5.10.2-5 inside and
lo and behold! My examples are working fine.

So... apologies for the noise and keep up with the good work!

Regards,

Flavio.


Bug#972886: dash: printf %b '\000' # does not produce NUL in output

2020-10-25 Thread Flavio Poletti
Package: dash
Version: 0.5.8-2.4
Severity: normal

Dear Maintainer,

I was trying out various examples in article "Rich's sh (POSIX shell)
tricks" and the example in section "Writing bytes to stdout by numeric
value" failed. It was working in Mac OS X /bin/sh.

The error arised when trying to print out a NUL byte.

The following examples will help show what the bug is about:

$ printf %b '\0074\0101\0076' | hexdump -c
000   <   A   >
003
$ printf %b '\0074\0001\0076' | hexdump -c
000   < 001   >
003
$ printf %b '\0074\\0076' | hexdump -c
000   <
001
$ perl -e 'print "<\x{0}>"' | hexdump -c
000   <  \0   >
003

The first two commands work as expected: all three octets are printed on
the standard output, as shown by the output from hexdump.

The third and the last command are expected to yield the same result,
but the one based on printf does not comply and stops processing the
input as soon as it reaches the \ string, which is also dropped from
the output.

I scanned through the list of bugs but found none about this specific
issue.

-- System Information:
Debian Release: 9.5
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-7-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US:en 
(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.8.1.1
ii  dpkg 1.18.25
ii  libc62.24-11+deb9u3

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true