Page MenuHome GnuPG
Feed Advanced Search

May 3 2016

PPed72 added a comment to T2345: Test mds.test fails if /bin/sh -> dash.

In data martedì 3 maggio 2016 15:13:04 CEST, hai scritto:

Werner Koch <wk@gnupg.org> added the comment:

From my dash man page:

echo [-n] args...
          Print the arguments on the standard output, separated by spaces.

Unless the -n option is present, a new

line is output following the arguments.

The version is 0.5.7 and the debian docs say.

May 3 2016, 6:29 PM · Bug Report
PPed72 added a comment to T2345: Test mds.test fails if /bin/sh -> dash.

Do whatever you prefer. I'm sorry that I bothered you with what is, after all, a
local problem. I'll try to push a workaround for this in Gentoo.

Thanks for your patience.

May 3 2016, 6:04 PM · Bug Report
PPed72 added a comment to T2345: Test mds.test fails if /bin/sh -> dash.

Right after I wrote my last reply I noticed that Gentoo patches dash to
"neuter" its echo builtin so that it recognizes neither options nor escape
sequences. So this is Gentoo (and derivatives) specific.

See (if you care) the discussions that led to this behaviour:
http://bugs.gentoo.org/337329
http://bugs.gentoo.org/527848

May 3 2016, 5:43 PM · Bug Report
PPed72 added a comment to T2345: Test mds.test fails if /bin/sh -> dash.

AFAIK dash does not support "echo -n". From "man dash":
echo args...

            Print the arguments on the standard output, separated by spaces.

            No arguments or backslash sequences are supported as they are not

portable. They will be printed out exactly as

            passed in.

            You can replace `echo -n ...` with the portable `printf %s ...`

construct.

May 3 2016, 4:57 PM · Bug Report
PPed72 added a comment to T2345: Test mds.test fails if /bin/sh -> dash.

I've made the following script to isolate the issue:
#!/bin/sh
echo_n_init=no
echo_n () {

if test "$echo_n_init" = "no"; then
  if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
    if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
      echo_n_n=
      echo_n_c='

'

    else
      echo_n_n='-n'
      echo_n_c=
    fi
  else
    echo_n_n=
    echo_n_c='\c'
  fi
  echo_n_init=yes
fi
echo $echo_n_n "${1}$echo_n_c"

}

echo_n "abcdefghijklmnopqrstuvwxyz" | gpg2 --with-colons --print-mds

If I run it with "bash -x" I get:
+ echo_n_init=no
+ echo_n abcdefghijklmnopqrstuvwxyz
+ test no = no
+ echo 'testing\c'
+ echo 1,2,3
+ gpg2 --with-colons --print-mds
+ grep c
+ echo -n testing
+ sed s/-n/xn/
+ echo 1,2,3
+ grep xn
+ echo_n_n=-n
+ echo_n_c=
+ echo_n_init=yes
+ echo -n abcdefghijklmnopqrstuvwxyz
:1:C3FCD3D76192E4007DFB496CCA67E13B:
:2:32D10C7B8CF96570CA04CE37F2A19D84240D3A89:
:3:F71C27109C692C1B56BBDCEB5B9D2865B3708DBC:
:11:45A5F72C39C5CFF2522EB3429799E49E5F44B356EF926BCF390DCCC2:
:8:71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73:
:9:FEB67349DF3DB6F5924815D6C3DC133F091809213731FE5C7B5F4999E463479FF2877F5F2936FA63BB43784B12F3EBB4:
:10:4DBFF86CC2CA1BAE1E16468A05CB9881C97F1753BCE3619034898FAA1AABE429955A1BF8EC483D7421FE3C1646613A59ED5441F
B0F321389F77F48A879C7B1F1:

which is correct. If I run it with "dash -x" I get:
+ echo_n_init=no
+ echo_n abcdefghijklmnopqrstuvwxyz
+ test no =+ no
gpg2 --with-colons --print-mds
+ grep c
+ echo testing\c
+ echo 1,2,3
+ echo -n testing
+ echo 1,2,3
+ sed s/-n/xn/
+ grep xn
+ echo_n_n=
+ echo_n_c=

+ echo_n_init=yes
+ echo abcdefghijklmnopqrstuvwxyz

:1:AD5DEB9B35AB55595BC8312CF1EE134F:
:2:7FDFFACEC05073FD23135CF94868A0076ABF3953:
:3:13F4E18DD89D9611E224C7A73E25C6A42BFF090F:
:11:DBB9A410F16C536637D928B37682A522E3A473864EF6915715DE81B3:
:8:DC6BEFD7DC150815AC9DA4477A059849BC60CE64B052F7D73F33239ADB80F292:
:9:5EAB880F1B7A7E5E888A745B650D705DF7DD1960728BE123088C897B5BCFD37042BE1EFD172CFC0B09E1705EB190A8F4:
:10:6B779E094FB3286174E9E7D08C3D65D6755AC29ACDBEDE2B48E35EA1E9F040E089F62ED8C1378AF2D999F4562334BB071D7493A
FEA19E62C00678F59AA624126:

which is, obviously, not correct.

May 3 2016, 1:05 PM · Bug Report
PPed72 added a project to T2345: Test mds.test fails if /bin/sh -> dash: Bug Report.
May 3 2016, 12:53 PM · Bug Report
PPed72 set Version to 2.1.11 on T2345: Test mds.test fails if /bin/sh -> dash.
May 3 2016, 12:53 PM · Bug Report