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

Bug 547414

Summary: postsync.d scripts being invoked with empty arguments (regression)
Product: Portage Development Reporter: Nick Bowler <nbowler>
Component: UnclassifiedAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS, REGRESSION
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 484436    

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:

   postsync.d/
          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‐
          ments.

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

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

  % 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
dev-util/cmake:           2.8.12.2-r1::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
Repositories:

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

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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE @OTHER-FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe"
CHOST="x86_64-pc-linux-gnu"
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"
DISTDIR="/usr/portage/distfiles"
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"
GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
INSTALL_MASK="/usr/share/cursors/xorg-x11/default 	/usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf 	/etc/profile.d/qtgui4.sh"
LANG="en_CA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/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"
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"
Unset:  CPPFLAGS, CTARGET, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Brian Dolbec (RETIRED) 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 (RETIRED) gentoo-dev 2015-05-18 23:38:51 UTC
Released in portage-2.2.19