Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547414 - postsync.d scripts being invoked with empty arguments (regression)
Summary: postsync.d scripts being invoked with empty arguments (regression)
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
Depends on:
Blocks: 484436
  Show dependency tree
Reported: 2015-04-22 15:39 UTC by Nick Bowler
Modified: 2015-05-18 23:38 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description Nick Bowler 2015-04-22 15:39:01 UTC
With the recent update to portage-2.2.18, I noticed that some of my postsync.d
scripts were failing.  This turns out to be because emerge is now calling them
with three empty arguments, as opposed to none in previous versions.

The portage man page quite clearly states that the script will be called with
no arguments:

          This directory is for user supplied postsync hooks to be
          run once after all repositories have been synced.  Each
          script is called in alphabetic order without any argu‐

But a quick test shows that this is not the case:

  % cat >/etc/portage/postsync.d/99_args <<'EOF'
printf 'Running %s\n' "$0"
printf 'Number of arguments: %d\n' "$#"
for arg; do printf '"%s"\n' "$arg"; done

  % emerge --sync
  === Sync completed for gentoo
  Running /etc/portage/postsync.d/99_args
  Number of arguments: 3

Portage 2.2.18 (python 2.7.9-final-0, default/linux/amd64/13.0, gcc-4.8.4, glibc-2.20-r2, 3.18.7 x86_64)
System uname: Linux-3.18.7-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q8300_@_2.50GHz-with-gentoo-2.2
KiB Mem:     3917332 total,    632892 free
KiB Swap:    2097148 total,   2047500 free
Timestamp of repository gentoo: Wed, 22 Apr 2015 00:45:01 +0000
sh bash 4.2_p53
ld GNU ld (Gentoo 2.24 p1.4) 2.24
distcc 3.1 x86_64-pc-linux-gnu [disabled]
ccache version 3.1.9 [enabled]
app-shells/bash:          4.2_p53::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.9-r1::gentoo, 3.3.5-r1::gentoo, 3.4.1::gentoo
dev-util/ccache:          3.1.9-r4::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.13.11::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo
sys-devel/binutils:       2.24-r3::gentoo
sys-devel/gcc:            3.4.6-r2::gentoo, 4.1.2::gentoo, 4.2.4-r1::gentoo, 4.8.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.20-r2::gentoo

    location: /usr/portage
    sync-type: websync
    sync-uri: rsync://
    priority: -1000

    location: /usr/local/portage
    masters: gentoo
    priority: 0

CFLAGS="-O2 -march=core2 -pipe"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
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.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/ssl/certs/ca-certificates.crt /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=core2 -pipe"
EMERGE_DEFAULT_OPTS="--keep-going --quiet-build --with-bdeps=y --autounmask-write=n --dynamic-deps=n --unordered-display"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe"
INSTALL_MASK="/usr/share/cursors/xorg-x11/default 	/usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf 	/etc/profile.d/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
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"
USE="X acl alsa amd64 berkdb bzip2 cairo cjk cli cracklib crypt cups curl cvs cxx doc dri enca exif fbcon fdt ffmpeg flac fontconfig fontforge fortran gdbm gnutls gpm graphviz gtk iconv icu idn imagemagick ipv6 jadetex jpeg kpathsea latex lcms libass lto mad mmx mmxext modules mp3 mp4 multilib ncurses nls nptl ogg opengl openmp otr pam pcre perl png python readline sdl session smp sse sse2 ssl svg tcpd tex4ht theora threads tiff truetype unicode vim-syntax vorbis xattr xcb xft xinerama xulrunner xv zlib" ABI_X86="64" 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" 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="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 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" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_CA en ja" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm mips mipsel ppc ppc64" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="intel fbdev" 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"
Comment 1 Brian Dolbec gentoo-dev 2015-04-22 17:04:25 UTC
While I admit I screwed that up.  I also wonder why they are failing having being passed 3 empty args.  If your scripts are not expecting args, what is causing them to fail?

Anyway, this is fixed in git commit 7a16988f4765963896170b92253ebbd4344216ea

P.S. emerge always passed the sync uri to the postsync hook script which was supplied by the portage-utils pkg.  It was that script that did not pass any args to the hooks.
Comment 2 Nick Bowler 2015-04-22 17:25:50 UTC
(In reply to Brian Dolbec from comment #1)
> While I admit I screwed that up.  I also wonder why they are failing having
> being passed 3 empty args.  If your scripts are not expecting args, what is
> causing them to fail?

In this specific case, the eix-update and eclean-dist programs both bail out
when given invalid command-line arguments (like empty strings).
Comment 3 Brian Dolbec gentoo-dev 2015-05-18 23:38:51 UTC
Released in portage-2.2.19