Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 305393 - dispatch-conf merging fails with sys-apps/diffutils-2.9
Summary: dispatch-conf merging fails with sys-apps/diffutils-2.9
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 307597
  Show dependency tree
 
Reported: 2010-02-16 13:55 UTC by Ian Abbott
Modified: 2010-03-03 11:22 UTC (History)
1 user (show)

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


Attachments
handle new sdiff exit status for diffutils-2.9 (diffutils_2_9.patch,1.85 KB, patch)
2010-02-18 08:15 UTC, Zac Medico
Details | Diff
handle new sdiff exit status for diffutils-2.9 (diffutils_2_9.patch,1.81 KB, patch)
2010-02-18 08:50 UTC, Zac Medico
Details | Diff
handle new sdiff exit status for diffutils-2.9 (diffutils_2_9.patch,641 bytes, patch)
2010-02-18 16:28 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Abbott 2010-02-16 13:55:15 UTC
By default /etc/dispatch-conf.conf uses this for interactive merges:

merge="sdiff --suppress-common-lines --output='%s' '%s' '%s'"

With diffutils-2.9, the above 'sdiff' command exited with status '1' if the inputs differed, but this causes the 'dispatch-conf' to assume the merge failed. It prints "Failure running 'merge' command" and ignores the output from the merge.

With diffutils-2.8.7, the above 'sdiff' command exited with status '0' even if the inputs differed, which was an incorrect exit status according to the man page.

Reproducible: Always

Steps to Reproduce:
1. emerge something that requires config file changes to be merged
2. run dispatch-conf
3. Use the 'm' option to merge changes in a file

Actual Results:  
After the merge, dispatch-conf reports "Failure running 'merge' command" and ignores the merged contents.

Expected Results:  
It should have shown the differences between the original config file and the merged version.

The default merge command in /etc/dispatch-conf.conf needs to be modified to treat an exit status of 1 from 'sdiff' as successful, or there needs to be a way to configure the expected successful exit status values.
Comment 1 Ian Abbott 2010-02-16 13:56:54 UTC
In other words, dispatch-conf was relying on broken behavior of sdiff by default, but now sdiff has been fixed, dispatch-conf is broken!
Comment 2 Ian Abbott 2010-02-16 14:01:53 UTC
It can be fixed by changing the merge command in /etc/dispatch-conf.conf as follows:

merge="sdiff --suppress-common-lines --output='%s' '%s' '%s' || test $? -lt 2"

But perhaps that is too shell-specific. Does dispatch-conf enforce use of a Bourne-type shell when spawning commands?
Comment 3 Ian Abbott 2010-02-16 14:12:34 UTC
My emerge --info in case it's relevant, but earlier versions of portage are affected by the bug too:

Portage 2.1.7.17 (default/linux/amd64/10.0/desktop, gcc-4.4.3, glibc-2.11-r1, 2.6.32-gentoo-r3-ija1 x86_64)
=================================================================
System uname: Linux-2.6.32-gentoo-r3-ija1-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_3800+-with-gentoo-2.0.1
Timestamp of tree: Mon, 15 Feb 2010 14:15:01 +0000
app-shells/bash:     4.1_p2
dev-java/java-config: 1.3.7-r1, 2.1.10
dev-lang/python:     2.6.4-r1, 3.1.1-r1
dev-util/cmake:      2.8.0-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.0-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.8.5-r3, 1.9.6-r2, 1.10.3, 1.11.1
sys-devel/binutils:  2.20
sys-devel/gcc:       3.3.6-r1, 3.4.6-r2, 4.2.4-r1, 4.3.4, 4.4.3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.32
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=k8 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
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=k8 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://www.mirrorservice.org/sites/www.ibiblio.org/gentoo http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en en_GB"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/desktop-effects /usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi adns alsa amd64 avahi berkdb branding bzip2 cairo cdr cgi cjk cli consolekit cracklib crypt cscope cups curl cxx dbus djvu doc dri dts dv dvd dvdr eds emboss encode esd evo exif expat fam ffmpeg firefox flac flash fortran gdbm gif glut gmp gnome gnome-keyring gnutls gpm graphviz gstreamer gtk gtkhtml guile hal htmlhandbook iconv idn imagemagick imap imlib ipod ipv6 java jpeg kde kerberos lcms ldap libnotify mad mikmod mmx mng modules mono motif mozsvg mp3 mp4 mpeg mudflap multilib musicbrainz ncurses nls no-helper nptl nptlonly nsplugin offensive ogg opengl openmp pam pcre pdf perl plotutils png policykit ppds pppd pulseaudio python qt3 qt3support qt4 quicktime rdesktop readline reflection ruby samba sasl sdl semantic-desktop session slang snmp spell spl sqlite sse sse2 ssl startup-notification svg sysfs tcl tcltk tcpd tetex threads thunar tiff tk truetype unicode usb vnc vorbis x264 xcb xine xml xorg xulrunner xv xvid zlib" ALSA_CARDS="hda-intel" 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_GB" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon ati vesa fbdev" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Comment 4 Zac Medico gentoo-dev 2010-02-18 08:15:52 UTC
Created attachment 220139 [details, diff]
handle new sdiff exit status for diffutils-2.9

Save as /tmp/diffutils_2_9.patch and apply as follows:

  patch /usr/lib/portage/bin/dispatch-conf /tmp/diffutils_2_9.patch
Comment 5 Zac Medico gentoo-dev 2010-02-18 08:50:17 UTC
Created attachment 220145 [details, diff]
handle new sdiff exit status for diffutils-2.9
Comment 6 Ian Abbott 2010-02-18 10:38:01 UTC
(In reply to comment #5)
> Created an attachment (id=220145) [details]
> handle new sdiff exit status for diffutils-2.9

I think the patch would work just as well if it didn't bother finding out the diffutils version number.  If the merge command is 'sdiff', the patch could treat an exit status less than 2 as valid irrespective of the version of diffutils.  This ought to be a bit faster than looking things up in the portage database.
Comment 7 SpanKY gentoo-dev 2010-02-18 10:55:58 UTC
indeed ... not relying on VDB would be a good thing so as to handle portability issues with EPREFIX type systems where diffutils is provided by the host.

if you really want to test the sdiff program, i'd suggest parsing the output:
[[ `sdiff --version < /dev/null` == *GNU*2.8.7* ]] && sdiff-is-busticated
Comment 8 Zac Medico gentoo-dev 2010-02-18 16:28:47 UTC
Created attachment 220177 [details, diff]
handle new sdiff exit status for diffutils-2.9
Comment 9 Zac Medico gentoo-dev 2010-03-03 11:22:14 UTC
This is fixed in 2.1.8 and 2.2_rc64.