Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 193486 - x86-chroot ecompressdir man
Summary: x86-chroot ecompressdir man
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 194041
  Show dependency tree
 
Reported: 2007-09-23 08:52 UTC by Mathias Rüdiger
Modified: 2007-09-28 00:14 UTC (History)
0 users

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


Attachments
fall back to using a bash loop with xargs just when the arg list is too long (loop_fallback.patch,771 bytes, patch)
2007-09-27 08:11 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Rüdiger 2007-09-23 08:52:27 UTC
The following error oucured during the installation.

ecompressdir: bzip2 -9 opt/x86-chroot/usr/share/man
/usr/lib64/portage/bin/ecompress: line 51: /bin/rm: Die Argumentliste ist zu lang
<- to many arguments

Reproducible: Always

Steps to Reproduce:
1.Just install x86-chroot
Comment 1 SpanKY gentoo-dev 2007-09-23 09:04:50 UTC
please be more verbose in how you encountered this problem

during a normal installation, there would be no "/opt/x86-chroot" visible from inside the chroot
Comment 2 Mathias Rüdiger 2007-09-23 12:26:13 UTC
The error happened during the installation of the package "app-emulation/x86-chroot-2006.1". During this installation there is nothing chrooted yet. /opt/x86-chroot is the default installation location. It looks just like this:

emerge --oneshot x86-chroot
Calculating dependencies... done!
>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) app-emulation/x86-chroot-2006.1 to /
 * stage3-i686-2006.1.tar.bz2 MD5 ;-) ...                                                                                                              [ ok ]
 * stage3-i686-2006.1.tar.bz2 RMD160 ;-) ...                                                                                                           [ ok ]
 * stage3-i686-2006.1.tar.bz2 SHA1 ;-) ...                                                                                                             [ ok ]
 * stage3-i686-2006.1.tar.bz2 SHA256 ;-) ...                                                                                                           [ ok ]
 * stage3-i686-2006.1.tar.bz2 size ;-) ...                                                                                                             [ ok ]
 * checking ebuild checksums ;-) ...                                                                                                                   [ ok ]
 * checking auxfile checksums ;-) ...                                                                                                                  [ ok ]
 * checking miscfile checksums ;-) ...                                                                                                                 [ ok ]
 * checking stage3-i686-2006.1.tar.bz2 ;-) ...                                                                                                         [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/2.6.22-gentoo-r6/build
 * Found sources for kernel version:
 *     2.6.22-gentoo-r6
 * Checking for suitable kernel configuration options...                                                                                               [ ok ]
>>> Unpacking source...
>>> Unpacking stage3-i686-2006.1.tar.bz2 to /var/tmp/portage/app-emulation/x86-chroot-2006.1/work/opt/x86-chroot
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/app-emulation/x86-chroot-2006.1 ...
>>> Source compiled.
>>> Test phase [not enabled]: app-emulation/x86-chroot-2006.1

>>> Install x86-chroot-2006.1 into /var/tmp/portage/app-emulation/x86-chroot-2006.1/image/ category app-emulation
>>> Completed installing x86-chroot-2006.1 into /var/tmp/portage/app-emulation/x86-chroot-2006.1/image/

ecompressdir: bzip2 -9 opt/x86-chroot/usr/share/binutils-data/i686-pc-linux-gnu/2.16.1/man
ecompressdir: bzip2 -9 opt/x86-chroot/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
ecompressdir: bzip2 -9 opt/x86-chroot/usr/share/man
/usr/lib64/portage/bin/ecompress: line 51: /bin/rm: Die Argumentliste ist zu lang


I dont know where ecompress is started, therefor i cannot write a patch myself.
Comment 3 Zac Medico gentoo-dev 2007-09-26 22:14:34 UTC
The problem is inside ecompressdir on this line:

find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | ${XARGS} -0 ${binary}

With all of the man pages in the chroot, the argument list is simply too long. Here is an example of a more scalable approach that unfortunately requires ${binary} to be executed once for each and every file:

find "${dir}" -type f ${negate} -iname '*'${suffix} -print0 | \
while read -d $'\0' file ; do ${binary} "${file}" ; done
Comment 4 SpanKY gentoo-dev 2007-09-26 23:58:46 UTC
err, no ... the error is line 51 in *ecompress*, not ecompressdir

that's the point of chaining to xargs ... so the cmdline limit is not a problem
Comment 5 Zac Medico gentoo-dev 2007-09-27 00:37:45 UTC
So, the extremely long argument line isn't a problem until we get to this line inside ecompress:

[[ -n ${suffix} ]] && rm -f "${@/%/${suffix}}"


Here's a solution that uses built-in stat calls to avoid invoking rm too many times unnecessarily:

if [[ -n ${suffix} ]] ; then
  for x in "${@}" ; do
    [[ -e ${x}${suffix} ]] && rm "${x}{suffix}"
  done
fi
Comment 6 Zac Medico gentoo-dev 2007-09-27 08:11:51 UTC
Created attachment 132009 [details, diff]
fall back to using a bash loop with xargs just when the arg list is too long

In most cases, this patch will perform just as good as the original method. It will only fall back to a slightly slower method when the arg list is too long.
Comment 7 m68k team gentoo-dev 2007-09-27 13:09:00 UTC
what's wrong with the solution we came up with on irc with `tr` ?
echo ${@/%/${suffix}$'\001'} | tr '\001' '\000' | xargs -0 rm -f
Comment 8 Zac Medico gentoo-dev 2007-09-28 00:14:00 UTC
(In reply to comment #7)
> what's wrong with the solution we came up with on irc with `tr` ?
> echo -n "${@/%/${suffix}$'\001'}" | tr '\001' '\000' | ${XARGS} -0 rm -f

This has been released in 2.1.3.10.