Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 25535 - Scripts running under dcron borking with familiar 'xargs: env. too large' error
Summary: Scripts running under dcron borking with familiar 'xargs: env. too large' error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 31794
Blocks:
  Show dependency tree
 
Reported: 2003-07-29 15:23 UTC by Gavin Panella
Modified: 2003-09-10 05:08 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Panella 2003-07-29 15:23:08 UTC
Many of my scheduled jobs running under dcron are breaking with the now familiar: 
 
  xargs: environment is too large for exec 
 
error.  This has been seen in bug #21438 and others, and comes down to a deliberate 
limitation in xargs.  It seems that dcron passes whatever environment it runs with through to 
all commands it invokes.  However, this environment is large partly due to many exported shell 
functions (provided by /sbin/runscript I guess), with the upshot that subsequent xargs 
invocations complain. 
 
Some possible resolutions: 
 
* Start dcron with a reduced environment: 
 
e.g. 
# diff /usr/portage/sys-apps/dcron/files/dcron.rc6 dcron.new 
13,14c13,17 
< 	start-stop-daemon --start --quiet --exec /usr/sbin/crond \ 
< 		-- >>/var/log/cron.log 2>&1 
--- 
> 	env -i bash <<-EOF 
> 		. /etc/profile 
> 		start-stop-daemon --start --quiet --exec /usr/sbin/crond \ 
> 			-- >>/var/log/cron.log 2>&1 
> 	EOF 
 
This also has the advantage that environment settings are not passed in to dcron when started 
by hand, e.g. CVSROOT. 
 
* Patch xargs to remove/relax the limitation: 
 
Bug #21438 has several links to discussions and patches. 
 
* Stop /sbin/runscript exporting shell functions: 
 
Unsetting all runscript's shell functions reduces the environment size to well under 20k (for me 
at least).  There may be applications other than xargs that impose environment size limits 
upon themselves, and this measure would help those too.  However, there may be a good 
reason for those functions to be exported. 
 
 
My preference would be to limit the environment passed to dcron, and to reduce the 
environment size in init.d scripts anyway by changing /sbin/runscript.  Modifying the behaviour 
of a ubiquitous tool like xargs is something to be considered quite carefully :-) 
 
Phew, that was a long one... :-) 

Reproducible: Always
Steps to Reproduce:
1.  Schedule a job that invokes xargs with dcron. 
Actual Results:  
xargs: environment is too large for exec 

Expected Results:  
 

Portage 2.0.48-r5 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r1) 
================================================================= 
System uname: 2.4.19-gentoo-r10 i686 AMD Athlon(tm) XP 2600+ 
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ 
http://194.83.57.7/sites/www.ibiblio.org/gentoo/ 
http://194.83.57.3/sites/www.ibiblio.org/gentoo/ 
http://194.83.57.2/sites/www.ibiblio.org/gentoo/ ftp://ftp.easynet.nl/mirror/gentoo//" 
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share/config 
/var/bind /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/config" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" 
PORTDIR="/usr/portage" 
DISTDIR="/usr/portage/distfiles" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR_OVERLAY="" 
USE="x86 oss 3dnow avi crypt encode foomaticdb gif jpeg gnome libg++ mad mikmod mmx 
mpeg ncurses nls pdflib png quicktime spell truetype xml2 xmms xv zlib gdbm berkdb slang 
readline arts svga tcltk java guile mysql postgres X sdl gpm tcpd pam libwww ssl perl python 
esd imlib oggvorbis gtk qt kde motif opengl mozilla ldap scanner acpi dga dvd gd innodb maildir 
samba usb -apm -cups" 
COMPILER="gcc3" 
CHOST="i686-pc-linux-gnu" 
CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" 
CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" 
ACCEPT_KEYWORDS="x86" 
MAKEOPTS="-j2" 
AUTOCLEAN="yes" 
SYNC="rsync://rsync.uk.gentoo.org/gentoo-portage" 
FEATURES="sandbox ccache"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-08-24 00:53:42 UTC
Even with baselayout .10 ?
Comment 2 Gavin Panella 2003-09-10 05:08:35 UTC
baselayout 1.8.6.10-r1 fixes it.  Cheers!