Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 581966 - app-crypt/gnupg-2.1.11-r1 fails mds.test test if /bin/sh -> dash
Summary: app-crypt/gnupg-2.1.11-r1 fails mds.test test if /bin/sh -> dash
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Crypto team [DISABLED]
URL: https://bugs.gnupg.org/gnupg/issue2345
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-03 11:27 UTC by Paolo Pedroni
Modified: 2016-05-19 21:12 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
gnupg-2.1.11-r1:20160503-111944.log.gz (gnupg-2.1.11-r1:20160503-111944.log.gz,27.00 KB, application/gzip)
2016-05-03 11:27 UTC, Paolo Pedroni
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Pedroni 2016-05-03 11:27:03 UTC
Created attachment 433078 [details]
gnupg-2.1.11-r1:20160503-111944.log.gz

I' ve already reported this upstream (see URL field)

If /bin/sh is dash, mds.test test fails with:
Hash algorithm MD5 is not installed (not an error)
mds.test: :2: :3: :11: :8: :9: :10: failed for a..z
FAIL: mds.test

[...]
======================================
1 of 34 tests failed
Please report to http://bugs.gnupg.org
======================================

If /bin/sh is bash everything is fine.

I've dug around a bit and I "think" I've found the culprit and a workaround (see upstream bug for details).

# emerge --info =app-crypt/gnupg-2.1.11-r1
Portage 2.2.26 (python 2.7.11-final-0, default/linux/amd64/13.0/desktop/plasma/systemd, gcc-5.3.0, glibc-2.22-r4, 4.4.8-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.4.8-gentoo-x86_64-Intel-R-_Core-TM-_i7-2600_CPU_@_3.40GHz-with-gentoo-2.2
KiB Mem:    16125884 total,   3867416 free
KiB Swap:    8171516 total,   8120684 free
Timestamp of repository gentoo: Tue, 03 May 2016 07:45:01 +0000
sh dash 0.5.8.2
ld GNU gold (Gentoo 2.25.1 p1.1 2.25.1) 1.11
distcc 3.2rc1 x86_64-pc-linux-gnu [enabled]
ccache version 3.2.4 [disabled]
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.2::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo
dev-util/ccache:          3.2.4::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            5.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000

kde
    location: /var/lib/layman/kde
    sync-type: git
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo kde
    priority: 0

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 1

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=sandybridge -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -flto=8 -fuse-linker-plugin -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fgraphite-identity -ftree-vectorize"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=sandybridge -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -flto=8 -fuse-linker-plugin -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fgraphite-identity -ftree-vectorize"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going y --with-bdeps y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup compress-build-logs config-protect-if-modified distcc distlocks ebuild-locks ipc-sandbox merge-sync news parallel-fetch protect-owned sandbox sfperms split-elog split-log strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://tux.rainside.sk/gentoo/ http://mirror.leaseweb.com/gentoo/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/"
LANG="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--sort-common -flto=8 -fuse-linker-plugin -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fgraphite-identity -ftree-vectorize"
MAKEOPTS="-j11 -l8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac aalib acl acpi adns alsa amd64 ao audiofile bash-completion bluetooth branding bzip2 cairo caps cdda cddb cdparanoia cdr cli cracklib crypt css cups curl cxx dbus declarative dga djvu dri dts dvd dvdr emboss encode exif expat fbcon ffmpeg fftw firefox flac fontconfig foomaticdb fortran ftp gd gdbm geoip gif gimp glamor gmp gnutls gphoto2 gpm graphviz gtk handbook iconv icu idn imagemagick imlib ipv6 java javascript jbig jpeg jpeg2k kde kipi lame lcms libass libcaca libnotify libsamplerate lm_sensors lua lzma lzo mad mmap mmx mmxext mng modules mp3 mp4 mpeg mplayer multilib musicbrainz ncurses nls nptl nsplugin offensive ogg openal openexr opengl openmp pam pango pcre pdf phonon plasma png policykit postscript ppds pulseaudio qml qt3support qt4 qt5 rdesktop readline recode samba sctp sdl seccomp semantic-desktop session sndfile sockets speex spell sqlite sse sse2 ssl startup-notification subversion svg symlink syslog systemd sysvipc taglib theora threads tidy tiff truetype udev udisks unicode upower usb vaapi vcd vim-syntax vnc vorbis wayland widgets win32codecs wmf wxwidgets x264 xattr xcb xcomposite xine xinerama xml xpm xscreensaver xv xvid yahoo zlib" ABI_X86="64" ALSA_CARDS="hda-intel virmidi" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="kodak ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver" LINGUAS="it" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 pypy pypy3" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

app-crypt/gnupg-2.1.11-r1::gentoo was built with the following:
USE="bzip2 gnutls nls readline usb -doc -ldap (-selinux) -smartcard -static -tofu -tools" ABI_X86="64"

# emerge -1pqv =app-crypt/gnupg-2.1.11-r1
[ebuild   R   ] app-crypt/gnupg-2.1.11-r1  USE="bzip2 gnutls nls readline usb -doc -ldap (-selinux) -smartcard -static -tofu -tools"
Comment 1 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-03 13:53:11 UTC
(In reply to Paolo Pedroni from comment #0)
> Created attachment 433078 [details]
> gnupg-2.1.11-r1:20160503-111944.log.gz
> 
> I' ve already reported this upstream (see URL field)

Thanks, then there isn't very much for me to do on this but helpful to be aware of it.
Comment 2 Paolo Pedroni 2016-05-03 16:08:46 UTC
The problem is local to Gentoo, because we "dumb down" dash builtin echo to ignore options and escape sequences.

Upstream will probably do nothing as they're going to rewrite tests from scratch soon.

I've pushed a PR (#1399) on github that fixes the problem locally substituting echo_n with printf in mds.test.

See if you want to accept it or whatever.

Thanks.
Comment 3 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-03 16:15:50 UTC
(In reply to Paolo Pedroni from comment #2)
> The problem is local to Gentoo, because we "dumb down" dash builtin echo to
> ignore options and escape sequences.
> 

Then its an issue with dash, not with gnupg

> 
> See if you want to accept it or whatever.
> 

I don't like deviating from upstream, so won't do it for this case.

My suggestion is re-assigning the issue to dash maintainers.
Comment 4 SpanKY gentoo-dev 2016-05-03 22:23:05 UTC
(In reply to Kristian Fiskerstrand from comment #3)

no, it's an issue with gnupg and not writing portable code.  it's dirt simple to do it the right way (portable).  blaming broken code on dash is a red herring.
Comment 5 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-03 22:37:41 UTC
(In reply to SpanKY from comment #4)
> (In reply to Kristian Fiskerstrand from comment #3)
> 
> no, it's an issue with gnupg and not writing portable code.  it's dirt
> simple to do it the right way (portable).  blaming broken code on dash is a
> red herring.

if it is Gentoo specific; 'The problem is local to Gentoo, because we "dumb down" dash builtin echo to ignore options and escape sequences.' carrying a patch for it for an unforeseeable future is not a good way to go (in particular for a test suite failure)
Comment 6 SpanKY gentoo-dev 2016-05-03 22:46:31 UTC
(In reply to Kristian Fiskerstrand from comment #5)

no, it isn't.  read the other bugs -- you cannot rely on echo supporting either \c or -n.  POSIX doesn't require it, and not all shells implement it.  that you ran into this problem while running dash under Gentoo is irrelevant.  bad code is still bad code, and in this case, gpg is wrong.  that echo_n func can be written in one line and work everywhere:
  echo_n() { printf '%s' "$*"; }

i'd post on that bug tracker, but their registration e-mail system is broken.
Comment 7 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-03 22:48:30 UTC
(In reply to SpanKY from comment #6)
> (In reply to Kristian Fiskerstrand from comment #5)
> 
> no, it isn't.  read the other bugs -- you cannot rely on echo supporting
> either \c or -n.  POSIX doesn't require it, and not all shells implement it.
> that you ran into this problem while running dash under Gentoo is
> irrelevant.  bad code is still bad code, and in this case, gpg is wrong. 

But is this something that is specifically removed for dash in Gentoo, or is the issue also in a pure upstream version?
Comment 8 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-03 23:03:20 UTC
(In reply to Kristian Fiskerstrand from comment #7)
> (In reply to SpanKY from comment #6)
> > (In reply to Kristian Fiskerstrand from comment #5)
> > 
> > no, it isn't.  read the other bugs -- you cannot rely on echo supporting
> > either \c or -n.  POSIX doesn't require it, and not all shells implement it.
> > that you ran into this problem while running dash under Gentoo is
> > irrelevant.  bad code is still bad code, and in this case, gpg is wrong. 
> 
> But is this something that is specifically removed for dash in Gentoo, or is
> the issue also in a pure upstream version?

To elaborate a bit on this; if there are specific, generally used, shells in pure upstream formats, please provide specific examples on the upstream bugtracker. In the opposite I do not feel that this is something we should carry a Gentoo specific patch for.
Comment 9 SpanKY gentoo-dev 2016-05-03 23:04:32 UTC
(In reply to Kristian Fiskerstrand from comment #7)

the changes made to dash in Gentoo have not gone upstream, and most likely won't as they aren't interested.  but again, focusing on dash makes no sense: gpg tries to use /bin/sh which means it wants to be POSIX compatible, but then it turns around and tries to require optional POSIX features.  we noticed with dash, but you could easily reproduce with other shells.

the whole point of making dash do this is to detect people writing bad code sooner rather than letting it sit around latent and showing up in the edge cases.  POSIX permits this behavior.  it's also because dash had its own extensions beyond POSIX which meant people wasted time trying to move from bash-specific code to POSIX-standard code while also accidentally introducing dash-specific behavior.  crying at the use of bashisms while turning a blind eye to dashisms is painfully ironic.
Comment 10 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-04 07:54:34 UTC
To have it included in this context, this is the email thread regarding a new test framework in GnuPG http://lists.gnupg.org/pipermail/gnupg-devel/2016-April/031027.html
Comment 11 Paolo Pedroni 2016-05-04 08:41:54 UTC
(In reply to SpanKY from comment #6)
> (In reply to Kristian Fiskerstrand from comment #5)
> 
> no, it isn't.  read the other bugs -- you cannot rely on echo supporting
> either \c or -n.  POSIX doesn't require it, and not all shells implement it.
> that you ran into this problem while running dash under Gentoo is
> irrelevant.  bad code is still bad code, and in this case, gpg is wrong. 
> that echo_n func can be written in one line and work everywhere:
>   echo_n() { printf '%s' "$*"; }
> 
> i'd post on that bug tracker, but their registration e-mail system is broken.

I'm sorry that I "awoke the sleeping dog" on this issue. In the upstream bug the mantainer says that he can't just use printf because it is absent on older Unices.

Seen as GnuPG test suite is going to be rewritten and the scope for this change is very limited, I'll just carry a local patch.

If everyone agrees I'll close this bug as WONTFIX and retire my pull request.

Thanks to vapier for his kind explanations.
Comment 12 SpanKY gentoo-dev 2016-05-04 18:30:28 UTC
(In reply to Paolo Pedroni from comment #11)

i don't think trying to work on systems w/out printf makes sense anymore.  even autoconf has dropped support for them starting with 2.70 and hard requires the tool now.  gnupg is written using autoconf, so unless they also plan on never upgrading beyond 2.69, printf too will become a hard dep to build gnupg.
Comment 13 SpanKY gentoo-dev 2016-05-05 02:51:20 UTC
the upstream bug tracker e-mails finally started coming through, but it doesn't seem like i can post comments to that bug.  guess i'm too dumb to figure out how it works. :/
Comment 14 Paolo Pedroni 2016-05-16 13:51:45 UTC
Shall I close this as WONTFIX, then?
Comment 15 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-19 19:54:57 UTC
(In reply to Paolo Pedroni from comment #14)
> Shall I close this as WONTFIX, then?

No, keep it open. I've been giving it a bit of more thought and even if this is a downstream specific issue, the fix is trivial enough and in a non-invasive place of the package, so I might apply it anyways for the benefit of dash users in Gentoo.
Comment 16 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-19 21:07:21 UTC
Fixed in gnupg 2.1.12
Comment 17 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-05-19 21:12:34 UTC
(In reply to Kristian Fiskerstrand from comment #15)
> (In reply to Paolo Pedroni from comment #14)
> > Shall I close this as WONTFIX, then?
> 
> No, keep it open. I've been giving it a bit of more thought and even if this
> is a downstream specific issue, the fix is trivial enough and in a
> non-invasive place of the package, so I might apply it anyways for the
> benefit of dash users in Gentoo.


Thanks for the patch, in the future, please attach it as a unified diff to the bug instead of a github pull request :)