Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 531244

Summary: x11-terms/xterm >=app-shells/dash-0.5.8.1-r2 fails with /bin/sh -> dash
Product: Gentoo Linux Reporter: Lars Wendler (Polynomial-C) (RETIRED) <polynomial-c>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED OBSOLETE    
Severity: normal CC: alexander, base-system, bugs+gentoo, dickey, jcallen, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 526268    
Attachments: build.log
xterm-304.ebuild.patch
xterm-312.ebuild.patch

Description Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2014-11-30 17:06:40 UTC
Created attachment 390660 [details]
build.log

configure: creating ./config.status
config.status: creating Makefile
sed: file /var/tmp/portage/x11-terms/xterm-312/temp/cs4hMQNY/subs-1.sed line 28: unterminated `s' command
config.status: creating df-install
sed: file /var/tmp/portage/x11-terms/xterm-312/temp/cs4hMQNY/subs-1.sed line 28: unterminated `s' command
config.status: creating minstall
sed: file /var/tmp/portage/x11-terms/xterm-312/temp/cs4hMQNY/subs-1.sed line 28: unterminated `s' command
config.status: creating xtermcfg.h
>>> Source configured.
>>> Compiling source in /var/tmp/portage/x11-terms/xterm-312/work/xterm-312 ...
make -j1
make: *** No targets.  Stop.
 * ERROR: x11-terms/xterm-312::gentoo failed (compile phase):
 *   emake failed



# du /var/tmp/portage/x11-terms/xterm-312/work/xterm-312/Makefile
0       /var/tmp/portage/x11-terms/xterm-312/work/xterm-312/Makefile


# emerge --info xterm
Portage 2.2.14 (python 2.7.8-final-0, default/linux/amd64/13.0/desktop/kde, gcc-4.9.2-asneeded, glibc-2.19-r1, 3.14.25 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.14.25-x86_64-Quad-Core_AMD_Opteron-tm-_Processor_2389-with-gentoo-2.2
KiB Mem:     8241920 total,    791932 free
KiB Swap:    2097148 total,   2096968 free
Timestamp of tree: Sun, 30 Nov 2014 07:00:01 +0000
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.3_p30-r1
dev-java/java-config:     2.2.0
dev-lang/perl:            5.20.1-r3
dev-lang/python:          2.7.8, 3.3.5-r1, 3.4.2
dev-util/cmake:           3.0.2
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.13.6
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r4, 1.10.3-r1, 1.11.6-r1, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.6.4, 4.8.3, 4.9.2
sys-devel/gcc-config:     1.8::poly-c
sys-devel/libtool:        2.4.3-r2::poly-c
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.16 (virtual/os-headers)
sys-libs/glibc:           2.19-r1::poly-c
Repositories: gentoo kde-sunset poly-c
Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=barcelona -mtune=barcelona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-3.0 /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/X11/Sessions /etc/X11/app-defaults /etc/X11/xinit /etc/adobe /etc/bonobo-activation /etc/ca-certificates /etc/ca-certificates.conf /etc/dbus-1 /etc/env.d /etc/fonts /etc/fonts/fonts.conf /etc/foomatic /etc/games /etc/gconf /etc/gentoo-release /etc/gimp /etc/gnome-vfs-2.0 /etc/gre.d /etc/gtk-2.0 /etc/hp /etc/hsqldb /etc/htdig /etc/init.d /etc/iproute2 /etc/java-config-2 /etc/lftp /etc/logrotate.d /etc/ntop /etc/opt /etc/pango /etc/profile.d /etc/qt4 /etc/revdep-rebuild /etc/sandbox.d /etc/sasl2 /etc/sensors.d /etc/sgml /etc/sound /etc/ssl /etc/ssmtp /etc/t1lib /etc/terminfo /etc/vbox /etc/xdg /etc/xinetd.d /etc/xml"
CXXFLAGS="-march=barcelona -mtune=barcelona -O2 -pipe"
DISTDIR="/var/tmp/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical --with-bdeps=y --misspell-suggestions=n --autounmask=n --quiet-build=n --verbose-slot-rebuilds=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/ ftp://ftp.tu-clausthal.de/pub/linux/gentoo/ http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
INSTALL_MASK="/etc/systemd /lib/systemd /lib32/systemd /lib64/systemd /usr/lib/systemd /usr/lib32/systemd /usr/lib64/systemd /etc/init.d/functions.sh"
LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/opt/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"
PORTDIR="/var/portage"
PORTDIR_OVERLAY="/var/lib/layman/kde-sunset /usr/local/portage"
SYNC="rsync://192.168.0.254/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 c++0x cairo caps cdda cdr cli cracklib crypt css cups cxx dbus declarative dri dts dvd dvdr emboss encode exif faac fam ffmpeg firefox flac gdbm gif glamor gles2 gmp gnutls gtk iconv icu idn imagemagick inotify jpeg jpeg2k kde kipi lame lcms libnotify lzma mac mad matroska midi mmap mmx mmxext mng modules mp3 mp4 mpeg mpfr multilib ncurses nls nptl nsplugin ogg opengl openmp opus pam pango pcre pdf phonon plasma png ppds qt3support qt4 quicktime readline rtmp schroedinger sdl session slang speex spell sse sse2 ssl startup-notification svg theora threads tiff truetype twolame udev unicode upower usb vaapi vcd vdpau vorbis vpx wxwidgets x264 x265 xattr xcb xcomposite xinerama xml xscreensaver xv xvid xvmc zlib zsh-completion" ABI_X86="64" ALSA_CARDS="emu10k1 hda-intel usb-audio" APACHE2_MODULES="access_compat alias auth_digest authn_anon auth_basic authn_core authn_default authn_file authz_core authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dir env file_cache filter headers include info log_config mime mime_magic rewrite status unique_id unixd userdir vhost_alias" ELIBC="glibc" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev joystick" KERNEL="linux" LIBREOFFICE_EXTENSIONS="pdfimport presenter-console presenter-minimizer" LINGUAS="de en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="radeon"
USE_PYTHON="2.7 3.3 3.4"
Unset:  CPPFLAGS, CTARGET, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

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

x11-terms/xterm-304 was built with the following:
USE="-Xaw3d openpty -toolbar truetype unicode"
Comment 1 Thomas Dickey 2014-12-01 01:17:39 UTC
In a quick check, I don't see a problem on Debian (which uses dash).
Perhaps there's a locale-related issue for instance with a punctuation
character in the sed-command.  The sed command is operating on 48-line
chunks of a longer sed-script; the reference to "subs-1" seems to be
the first chunk (in config.status).  In the check I ran, that is this
line:
s,@PATH_SEPARATOR@,:,;t t 
(which may/may not be the same as your build.  But verifying that might
help - also knowing what the locale settings are.
Comment 2 Andrew Miller 2014-12-01 08:38:55 UTC
I can't reproduce this, it might be a problem on your end.

$ readlink /bin/sh
dash
$ cd /usr/portage/x11-terms/xterm
$ sudo ebuild xterm-312.ebuild unpack prepare configure
[snip]
configure: creating ./config.status
config.status: creating Makefile
config.status: creating df-install
config.status: creating minstall
config.status: creating xtermcfg.h
>>> Source configured.
Comment 3 Alexander Tsoy 2014-12-01 08:47:57 UTC
This bug is only reproducible with dash-0.5.8.1-r2, where echo doesn't support '-n' option.
Comment 4 Alexander Tsoy 2014-12-01 08:52:58 UTC
vm3020 xterm-304 # grep ac_cv_have_x config.log 
ac_cv_have_x='have_x=yes                ac_x_includes= ac_x_libraries=/usr/lib64'
Comment 5 Alexander Tsoy 2014-12-01 08:54:05 UTC
Oops.. Please ignore comment 4
Comment 6 Alexander Tsoy 2014-12-01 09:16:30 UTC
dash-0.5.8.1 vs dash-0.5.8.1-r2:

 s,@target_alias@,,;t t
-s,@ECHO_C@,\c,;t t
+s,@ECHO_C@,
+,;t t
 s,@ECHO_N@,,;t t


Looks like the real problem is that configure is generated with old autoconf 2.52.20121002 and it have a strange check for echo options. eautoreconf fails because macro AC_DIVERT_HELP is only defined in aclocal.m4 shipped with xterm:

configure:6428: error: possibly undefined macro: AC_DIVERT_HELP
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Comment 7 Thomas Dickey 2014-12-01 09:19:46 UTC
If there's a problem running the unmodified configure script, I'm interested
in that.  For regenerating the configure script, see
http://invisible-island.net/autoconf/autoconf.html
Comment 8 Alexander Tsoy 2014-12-01 10:11:43 UTC
configure script is generated with patched autoconf [1]. AC_DIVERT_HELP macro defined only in patched acgeneral.m4 and definition for that macro is not shipped with xterm.

[1] ftp://invisible-island.net/autoconf/autoconf-2.12-971230.patch.gz
Comment 9 Alexander Tsoy 2014-12-01 10:17:21 UTC
(In reply to Alexander Tsoy from comment #6)
> macro AC_DIVERT_HELP is only defined in aclocal.m4 shipped with xterm:

That's not correct. As I mentioned in previous comment, it is defined in patched acgeneral.m4 :(
Comment 10 Thomas Dickey 2014-12-01 11:21:58 UTC
A "2.12" patch cannot possibly be current.
This is current, as noted on the webpage:
http://invisible-island.net/datafiles/release/autoconf.tar.gz
Comment 11 Alexander Tsoy 2014-12-01 12:29:33 UTC
Created attachment 390698 [details, diff]
xterm-304.ebuild.patch

The attached patch fixes this bug. I've tested it with xterm-304 and -312.
Comment 12 Alexander Tsoy 2014-12-01 12:34:53 UTC
Created attachment 390702 [details, diff]
xterm-312.ebuild.patch

Cleanup sed script.
Comment 13 Andrew Miller 2014-12-02 07:12:45 UTC
(In reply to Alexander Tsoy from comment #3)

Indeed, I can reproduce this bug with the new version of dash.

(In reply to Alexander Tsoy from comment #12)

This patch works for me. I tested it on xterm-297, -304 and -312.

Question is, is it appropriate? On one hand, the delay in src_prepare() is negligable:

$ sudo ebuild xterm-312.ebuild unpack
[snip]
$ time sudo ebuild xterm-312.ebuild prepare
>>> Existing ${T}/environment for 'xterm-312' will be sourced.
[snip]
real    0m5.975s
user    0m5.460s
sys     0m0.380s

On the other hand, it prints an ugly warning message. I say wait for upstream to put out a new release.
Comment 14 Thomas Dickey 2014-12-02 09:00:41 UTC
A copy of the relevant config.status and config.log would be helpful.
I do not know how to reproduce this; installing Gentoo isn't a solution.
Comment 15 Alexander Tsoy 2014-12-02 13:14:38 UTC
(In reply to Andrew Miller from comment #13)

I've attached a patch just to prove that it's an autoconf's fault.

> On the other hand, it prints an ugly warning message.

It's a QA warning recently added to autotools.eclass and is easy fixable:
mv configure.{in,ac} || die


(In reply to Thomas Dickey from comment #14)

See patch [1] which was applied to dash-0.5.8.1-r2 in Gentoo. It changes echo behavior as follows:
- disable interpretation of escape sequences;
- drop support for '-n' option.

So the following shell code doesn't work in any way with that version of dash (and it is really not portable):
echo $ECHO_N "Some text $ECHO_C"

autoconf >=2.62 uses AS_ECHO macro which works fine.


[1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-shells/dash/files/dash-0.5.8.1-dumb-echo.patch?view=markup
Comment 16 Andrew Miller 2014-12-02 17:28:00 UTC
(In reply to Thomas Dickey from comment #14)

You need a shell which doesn't support 'echo -n', like dash-0.5.8.1-r2, which is a Gentoo-specific version of dash. Note the '-r2' suffix, which signifies a change made in Gentoo, not an upstream change. The vast majority of shells do support 'echo -n', which is why this bug hasn't been discovered until now.

On Debian, you could try this:

1. tar xzvf xterm-312.tgz
2. cd xterm-312/
3. emacs -nw
4. type alt-x, type eshell, press return
5. ./configure

I think we have two options to close this bug:

1. Apply the patch in comment #12 and workaround the warning message that is printed.
2. You could put out minor revisions of xterm-297, -304 and -312, that have configure scripts generated by a recent version of autoconf.
Comment 17 Thomas Dickey 2014-12-03 09:28:30 UTC
There were two choices suggested; one was specific to Gentoo,
the other was specific to me (so that was not offering a choice).
I already had a to-do item to cleanup a warning message for Solaris.
From the discussion, it appears that Gentoo prefers the Solaris behavior,
so any upstream changes to xterm would necessarily reference Solaris.
Comment 18 Chí-Thanh Christopher Nguyễn gentoo-dev 2014-12-03 15:48:31 UTC
If I understand comment #15 and comment #16 correctly, the problem happens with any shell that does not support "echo -n" (e.g. Gentoo patched dash) and is fixed by generating configure with autoconf-2.62 or later.

In that case it appears preferable to upgrade the autoconf version that is used to generate configure.
Comment 19 Thomas Dickey 2014-12-04 01:13:09 UTC
hmm - comment 6 shows the fragment I was looking for (had not noticed before).
At first glance, it seemed that the "fix" was to suppress the newline in the
substitution for ECHO_C.  However, checking the standard at

http://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html

I see that the actual problem is that the patch made to dash is defective.

The patch removes

 nonl += conv_escape_str(*argv);

which provides the functionality described as "The following character sequences shall be recognized on XSI-conformant systems within any of the arguments:".
The remaining call to outstr() does not provide this functionality.  It is lost. Because the patched dash fails to follow the standard in this area, the script falls through into the obscure case noted.

autoconf uses the echo/whatever feature only in 2 places, and in neither is the feature actually necessary (empty strings would suffice).  A standard-conforming shell would give that behavior.  (What I'm left with is my original to-do item; there's nothing here that needs any of my attention).
Comment 20 Chí-Thanh Christopher Nguyễn gentoo-dev 2014-12-04 16:15:36 UTC
CC'ing dash maintainers
Comment 21 SpanKY gentoo-dev 2015-04-04 22:09:49 UTC
(In reply to Thomas Dickey from comment #19)

not really.  the XSI extensions are just that -- extensions.  we disabled said extensions in dash because they cause more problems than they're worth, and relying on them is not portable.

plus, if you read the spec closer, you'll see the choices are one of two:
(1) -n/escape sequences are implementation defined (i.e. not portable, and the dash change disables those entirely)
(2) XSI compliant where -n is a string, not an option, and you get escape sequences.  so an XSI compliant system would do:
 `echo -n foo | hexdump -C`  -> 2d 6e 20 66 6f 6f 0a
 `echo -n \t\n | hexdump -C` -> 2d 6e 20 09 0a

you cannot rely on an implementation supporting both escape sequences and the -n option.  dash & bash already diverge here -- dash supports -n & escape (which means it is *not* XSI compliant, but it does fall into the "implementation defined" area), while bash requires the -e flag.

simply use `printf` if you want to be portable and have escape sequences.
Comment 22 Pacho Ramos gentoo-dev 2018-06-19 07:09:30 UTC
are you still hitting this with 331?
Comment 23 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2018-06-19 12:02:29 UTC
Seems to be no longer an issue.