Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 314493 - libtool.eclass fails terribly when PORTDIR contains special characters
Summary: libtool.eclass fails terribly when PORTDIR contains special characters
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 315239 315273 315279 315363 315499 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-10 11:27 UTC by Michał Górny
Modified: 2010-04-15 18:16 UTC (History)
5 users (show)

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


Attachments
Example build log (libXext-9999) (build.log,2.85 KB, text/plain)
2010-04-10 11:28 UTC, Michał Górny
Details
The proof-of-concept patch (libtool.eclass.diff,640 bytes, patch)
2010-04-10 12:29 UTC, Michał Górny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-10 11:27:35 UTC
If system-specific PORTDIR contains special characters, elibtoolize fails terribly trying to apply patches. I guess the fragment directly responsible for that is line 95:

    for x in $(ls -d "${patch_dir}"/* 2> /dev/null | grep -v 'CVS' | sort -r) ; do

which indeed does fail when ${patch_dir} contains special characters. Thus, all ebuilds relying on elibtoolize (e.g. live xorg ones) fail too.

I'm attaching an example build log.

--
Portage 2.2_rc67 (default/linux/amd64/10.0/desktop, gcc-4.4.3, glibc-2.11-r1, 2.6.33-gentoo-mgorny-amd64 x86_64)
=================================================================
System uname: Linux-2.6.33-gentoo-mgorny-amd64-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_3800+-with-gentoo-2.0.1
Timestamp of tree: Sat, 10 Apr 2010 08:20:01 +0000
app-shells/bash:     4.1_p5
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.5-r1, 2.7_pre20100321, 3.1.2-r1, 3.2_pre20100321
dev-util/cmake:      2.8.1
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     9999
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1
sys-devel/gcc:       4.4.3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.33
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -O2 -pipe"
DISTDIR="/usr/local/portage/distfiles"
EMERGE_DEFAULT_OPTS="--ask --keep-going"
FEATURES="assume-digests collision-protect distlocks fixpackages news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="pl_PL.UTF-8"
LC_ALL="pl_PL.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS=""
MAKEOPTS="-j3"
PKGDIR="/usr/local/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --times --compress --force --whole-file --delete --stats --timeout=45 --exclude=/distfiles --exclude=/packages --exclude=/local"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/usr/
 ▲ 
▲ ▲"
PORTDIR_OVERLAY="/usr/local/portage/layman/x11 /usr/local/portage/layman/gamerlay /usr/local/portage/layman/science /usr/local/portage/layman/perl-experimental /usr/local/portage/layman/sunrise /usr/local/portage/layman/java-overlay /usr/local/portage/layman/games /usr/local/portage/layman/qting-edge /usr/local/portage/layman/python /usr/local/portage/layman/kde-sunset"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 avahi bash-completion bluetooth branding bzip2 cairo cdr cli consolekit cracklib crypt cups curl cxx dbus dirac directfb djvu dri dts dvd dvdr emboss encode exif expat fam fbcon fftw firefox flac fontconfig fortran gd gdbm gif gmp gnome-keyring gnutls gpm graphviz gtk iconv icu idn imagemagick ipv6 java6 jbig jpeg jpeg2k kate lapack lcms libedit libnotify libproxy mad matroska mikmod mmap mmx mmxext mng modules mp3 mp4 mpeg mtp mudflap multilib ncurses nptl nptlonly ogg opencore-amr openexr opengl openmp pam pango pch pcre pdf perl png ppds pppd python qt3support qt4 raw readline reflection schroedinger sdl session slang smp sndfile speex spell spl sse sse2 ssl ssse3 startup-notification svg sysfs tcpd theora threads tiff timidity truetype unicode usb v4l2 vcd vim-syntax vorbis wavpack wifi wmf x264 xcb xcomposite xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" SANE_BACKENDS="artec_eplus48u" USERLAND="GNU" VIDEO_CARDS="radeon vesa" 
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-10 11:28:04 UTC
Created attachment 227239 [details]
Example build log (libXext-9999)
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-10 12:29:42 UTC
Created attachment 227259 [details, diff]
The proof-of-concept patch

My patch is based on an assumption that the contents of ELT_PATCH_DIR are known not to use any special characters in filenames. Thus, instead of using full paths, we cd into ${ELT_PATCH_DIR} and use relative, safe paths.

elibtoolize() probably doesn't require us to stay in the directory it sets (it seems to use absolute paths everywhere) and it returns to the original calling pwd anyway -- that's why the patch doesn't save pwd nor uses subshelling.

We could even cd into "${ELT_PATCH_DIR}/${patch_set}" (old ${patch_dir}) but this way we lose ability to display the dirname in ELT_try_and_apply_patch().
Comment 3 SpanKY gentoo-dev 2010-04-14 02:14:06 UTC
while the wrapper func does take care of resetting the PWD, it doesnt make it a good code practice to extend.  so if there is going to be any dir changing, it's going to be via pushd/popd.

since there doesnt seem to be a clean way to build up the list of files w/out changing dirs w/out using a subshell, changing dirs looks like the way to go.

however, i rewrote the function completely to clean it up (and fix other issues as well).  thanks for the notice.

http://sources.gentoo.org/eclass/libtool.eclass?r1=1.85&r2=1.86
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2010-04-14 05:53:38 UTC
Thank you, it seems to work correctly now.
Comment 5 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-14 17:17:16 UTC
(In reply to comment #3)
> http://sources.gentoo.org/eclass/libtool.eclass?r1=1.85&r2=1.86

This change broke some packages.
Comment 6 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-14 17:17:50 UTC
*** Bug 315239 has been marked as a duplicate of this bug. ***
Comment 7 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-14 17:18:10 UTC
*** Bug 315273 has been marked as a duplicate of this bug. ***
Comment 8 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-04-14 17:18:42 UTC
*** Bug 315279 has been marked as a duplicate of this bug. ***
Comment 9 SpanKY gentoo-dev 2010-04-14 18:15:03 UTC
the popd arg shouldnt have been there

http://sources.gentoo.org/eclass/libtool.eclass?r1=1.86&r2=1.87
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2010-04-14 18:23:25 UTC
thanks mike
Comment 11 Jorge Manuel B. S. Vicetto (RETIRED) Gentoo Infrastructure gentoo-dev 2010-04-14 23:40:40 UTC
*** Bug 315363 has been marked as a duplicate of this bug. ***
Comment 12 Florian Demski 2010-04-15 05:01:53 UTC
Works for me. Thanks.
Comment 13 Billy O'Connor 2010-04-15 05:44:32 UTC
Man, that was fast.  Works like a charm.
Comment 14 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2010-04-15 18:16:51 UTC
*** Bug 315499 has been marked as a duplicate of this bug. ***