Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 129670 - dispatch-conf fails with diff3 error and overwrites old config file.
Summary: dispatch-conf fails with diff3 error and overwrites old config file.
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 100066 130591 (view as bug list)
Depends on:
Blocks: 147007
  Show dependency tree
 
Reported: 2006-04-12 02:47 UTC by Steven Green
Modified: 2007-08-10 20:46 UTC (History)
6 users (show)

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


Attachments
use the diff exit code to detect two binary files that differ (diff_exit_code.patch,1.22 KB, patch)
2006-11-01 01:42 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Green 2006-04-12 02:47:37 UTC
Remerging cyrus-sasl and then running dispatch-conf displays an error message:
"diff3: subsidiary program `/usr/bin/diff' failed (exit status 2)"
and then overwrites the old version of /etc/sasl2/sasldb2 file with the new one.

I can not see where diff3 is used from within dispatch-conf, but it seems that if an error occurs it should leave the files intact instead of overwriting with a new one.

I can make this happen consistently by restoring my old sasldb2 and copying /etc/archive-config/etc/sasl2/sasldb2.dist into /etc/sasl2/._cfg0001_sasldb2 and then running dispatch-config.

Manually running: "diff -Nu sasldb2 sasldb2.orig; echo $?" prints out 2.

Also see See bug 82250 which seems related.
Comment 1 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-04-12 05:36:32 UTC
Please attach emerge info
Comment 2 Steven Green 2006-04-12 08:01:05 UTC
Portage 2.0.54 (default-linux/x86/2006.0, gcc-3.4.5, glibc-2.3.5-r3, 2.6.15-gentoo-r1 i686)
=================================================================
System uname: 2.6.15-gentoo-r1 i686 AMD Athlon(tm) XP 1700+
Gentoo Base System version 1.6.14
ccache version 2.3 [enabled]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks sandbox sfperms strict"
GENTOO_MIRRORS="ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp.du.se/pub/os/gentoo http://ftp.easynet.nl/mirror/gentoo/ http://ftp.lug.ro/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://ftp.heanet.ie/pub/gentoo/"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X acpi amd apache2 audiofile autofs berkdb bitmap-fonts bzip2 cdr cgi chroot cli crypt ctype cups curl dba doc dri dvd dvdr eds emacs emboss encode esd exif expat fam fastbuild fastcgi ffmpeg foomaticdb force-cgi-redirect fortran ftp gd gdbm gif gimpprint gpm gstreamer gtk gtk2 idn imap imlib imlib2 ipv6 isdnlog java javascript jikes jpeg junit lcms libg++ libwww mailwrapper memlimit milter mng mp3 mysql ncurses nls nptl nptlonly ogg opengl pam pcre pdflib pear perl php png posix postgres ppds pppd python qt readline samba sasl sendmail session simplexml soap sockets spell spl ssl tcpd tetex tiff tokenizer truetype truetype-fonts type1-fonts udev unicode urandom usb vorbis xml xml2 xmms xsl xv zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS

Comment 3 Jakub Moc (RETIRED) gentoo-dev 2006-04-20 22:36:52 UTC
*** Bug 130591 has been marked as a duplicate of this bug. ***
Comment 4 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-04-21 20:52:37 UTC
(In reply to comment #2)
> Portage 2.0.54 (default-linux/x86/2006.0, gcc-3.4.5, glibc-2.3.5-r3,
> 2.6.15-gentoo-r1 i686)
> =================================================================
> System uname: 2.6.15-gentoo-r1 i686 AMD Athlon(tm) XP 1700+
> Gentoo Base System version 1.6.14
> ccache version 2.3 [enabled]
> dev-lang/python:     2.4.2
> sys-apps/sandbox:    1.2.12
> sys-devel/autoconf:  2.13, 2.59-r7
> sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
> sys-devel/binutils:  2.16.1
> sys-devel/libtool:   1.5.22
> virtual/os-headers:  2.6.11-r3
> ACCEPT_KEYWORDS="x86"
> AUTOCLEAN="yes"
> CBUILD="i686-pc-linux-gnu"
> CFLAGS="-march=athlon-xp -O3 -pipe"
> CHOST="i686-pc-linux-gnu"
> CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
> /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/
> /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/
> /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind
> /var/qmail/control"
> CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
> CXXFLAGS="-march=athlon-xp -O3 -pipe"
> DISTDIR="/usr/portage/distfiles"
> FEATURES="autoconfig ccache distlocks sandbox sfperms strict"
> GENTOO_MIRRORS="ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/
> ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
> http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/
> http://ftp.du.se/pub/os/gentoo http://ftp.easynet.nl/mirror/gentoo/
> http://ftp.lug.ro/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/
> http://ftp.heanet.ie/pub/gentoo/"
> PKGDIR="/usr/portage/packages"
> PORTAGE_TMPDIR="/var/tmp"
> PORTDIR="/usr/portage"
> PORTDIR_OVERLAY="/usr/local/portage"
> SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
> USE="x86 X acpi amd apache2 audiofile autofs berkdb bitmap-fonts bzip2 cdr cgi
> chroot cli crypt ctype cups curl dba doc dri dvd dvdr eds emacs emboss encode
> esd exif expat fam fastbuild fastcgi ffmpeg foomaticdb force-cgi-redirect
> fortran ftp gd gdbm gif gimpprint gpm gstreamer gtk gtk2 idn imap imlib imlib2
> ipv6 isdnlog java javascript jikes jpeg junit lcms libg++ libwww mailwrapper
> memlimit milter mng mp3 mysql ncurses nls nptl nptlonly ogg opengl pam pcre
> pdflib pear perl php png posix postgres ppds pppd python qt readline samba sasl
> sendmail session simplexml soap sockets spell spl ssl tcpd tetex tiff tokenizer
> truetype truetype-fonts type1-fonts udev unicode urandom usb vorbis xml xml2
> xmms xsl xv zlib userland_GNU kernel_linux elibc_glibc"
> Unset:  ASFLAGS, CTARGET, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS,
> MAKEOPTS
> 

Please upgrade to portage 2.1_pre9 and try again, it should be fixed there.
Comment 5 Steven Green 2006-04-24 08:41:10 UTC
Nope... still doesn't work:

After emerge you have something like:

ls -la /etc/sasl
total 65
drwxr-xr-x  2 root root   136 Apr 24 16:34 .
drwxr-xr-x 70 root root  4808 Apr 24 16:33 ..
-rw-r-----  1 root root 49152 Apr 24 16:34 ._cfg0001_sasldb2
-rw-r--r--  1 root root     0 Apr 22 11:51 .keep
-rw-r-----  1 root mail 12288 Apr 22 11:51 sasldb2


After dispatch-conf, you still end up with sasldb2 being overwritten with the new one.

diff3: subsidiary program `/usr/bin/diff' failed (exit status 2)

ls -la /etc/sasl2
total 53
drwxr-xr-x  2 root root    96 Apr 24 16:35 .
drwxr-xr-x 70 root root  4808 Apr 24 16:33 ..
-rw-r--r--  1 root root     0 Apr 22 11:51 .keep
-rw-r-----  1 root mail 49152 Apr 24 16:35 sasldb2

The contents of /etc/config-archive/etc/sasl however contains:
ls -la /etc/config-archive/etc/sasl2
total 62
drwxr-xr-x  2 root root   104 Apr 24 16:35 .
drwxr-xr-x 29 root root  1568 Apr 24 16:28 ..
-rw-r-----  1 root root 12288 Apr 22 11:51 sasldb2
-rw-r-----  1 root root 49152 Apr 24 16:34 sasldb2.dist
Comment 6 Steven Green 2006-04-24 08:56:15 UTC
It does not always give the diff error.

I just tried deleting /etc/config/archive/etc/sasl, then I got the same results:

rm -rf /etc/config/archive/etc/sasl
emerge -v cyrus-sasl
...

server1 sasl2 # ls -la /etc/sasl2
total 49
drwxr-xr-x  2 root root   136 Apr 24 16:45 .
drwxr-xr-x 70 root root  4808 Apr 24 16:46 ..
-rw-r-----  1 root mail 49152 Apr 24 16:45 ._cfg0000_sasldb2
-rw-r--r--  1 root root     0 Apr 24 16:45 .keep
-rw-r-----  1 root mail 12288 Apr 22 11:51 sasldb2
server1 etc # dispatch-conf
server1 etc # ls -la /etc/sasl2
total 53
drwxr-xr-x  2 root root    96 Apr 24 16:46 .
drwxr-xr-x 70 root root  4808 Apr 24 16:46 ..
-rw-r--r--  1 root root     0 Apr 24 16:45 .keep
-rw-r-----  1 root mail 49152 Apr 24 16:46 sasldb2
server1 etc # ls -l /etc/config-archive/etc/sasl2/
total 60
-rw-r----- 1 root root 12288 Apr 22 11:51 sasldb2
-rw-r----- 1 root root 49152 Apr 24 16:45 sasldb2.dist
server1 etc #


dispatch-conf did not prompt for anything... it just ran and immediately returned to prompt



server1 ~ # emerge info
*** Deprecated use of action 'info', use '--info' instead
Portage 2.1_pre9-r4 (default-linux/x86/2006.0, gcc-3.4.5, glibc-2.3.5-r3, 2.6.15-gentoo-r1 i686)
=================================================================
System uname: 2.6.15-gentoo-r1 i686 AMD Athlon(tm) XP 1700+
Gentoo Base System version 1.6.14
ccache version 2.3 [enabled]
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/eselect/compiler /etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache confcache distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="ftp:///ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ http://ftp.du.se/pub/os/gentoo http://ftp.easynet.nl/mirror/gentoo/ http://ftp.lug.ro/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/ http://ftp.heanet.ie/pub/gentoo/"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X acpi amd apache2 autofs berkdb bitmap-fonts bzip2 cgi chroot cli crypt cups curl doc dri dvd dvdr eds emacs emboss encode esd exif expat fastcgi foomaticdb fortran gd gdbm gif gimpprint gpm gstreamer gtk gtk2 idn imap imlib imlib2 ipv6 isdnlog java javascript jikes jpeg libg++ libwww mailwrapper milter mp3 mysql ncurses nls nptl nptlonly ogg opengl pam pcre pdflib pear perl php png postgres ppds pppd python qt readline reflection samba sasl sendmail session spell spl ssl tcpd tetex tiff truetype truetype-fonts type1-fonts udev unicode urandom usb vorbis xml xml2 xmms xorg xsl xv zlib elibc_glibc kernel_linux userland_GNU"
Unset:  ASFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTDIR_OVERLAY
Comment 7 Wulf Krueger (RETIRED) gentoo-dev 2006-08-04 17:32:09 UTC
This has been happening with every single cyrus-sasl update for me for a long time now. Today it happened again:

RCS file: /etc/config-archive/etc/sasl2/sasldb2,v
1.3 locked
done
/etc/config-archive/etc/sasl2/sasldb2,v  <--  /etc/config-archive/etc/sasl2/sasldb2
file is unchanged; reverting to previous revision 1.3
done
/etc/config-archive/etc/sasl2/sasldb2,v  -->  /etc/config-archive/etc/sasl2/sasldb2
revision 1.1.1.6
done
RCS file: /etc/config-archive/etc/sasl2/sasldb2,v
retrieving revision 1.1.1.6
retrieving revision 1.3
Merging differences between 1.1.1.6 and 1.3 into /etc/config-archive/etc/sasl2/sasldb2; result to stdout
rcsmerge: warning: conflicts during merge
RCS file: /etc/config-archive/etc/sasl2/sasldb2,v
1.1.1.6 locked
done
/etc/config-archive/etc/sasl2/sasldb2,v  <--  /etc/config-archive/etc/sasl2/sasldb2
new revision: 1.1.1.7; previous revision: 1.1.1.6
done

My sasldb was empty afterwards. This is extremely disruptive.
Comment 8 Zac Medico gentoo-dev 2006-10-31 03:55:30 UTC
(In reply to comment #0)
> Manually running: "diff -Nu sasldb2 sasldb2.orig; echo $?" prints out 2.

The problem is that both the replace-cvs (which defaults to "yes"!) and the replace-wscomments options use assumptions (about diff -Nu ouput) that work for plain text files but fail for binary files.  The output of the above command would be "Files sasldb2 and sasldb2.orig differ", which is then filtered to nothing by the following grep commands:

DIFF_CVS_INTERP      = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"'
DIFF_WSCOMMENTS      = 'diff -Nu %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"'

It should be possible to work around this bug by putting replace-cvs=no and replace-wscomments=no in /etc/dispatch-conf.conf.  For a proper fix, I'm not sure if we should rely on the exit code from diff, since it might vary depending on the diff implementation.  If we use the --text option of diff, then it should behave practically the same for both binary and plain text files.  That may be a good solution.
Comment 9 Zac Medico gentoo-dev 2006-10-31 04:03:47 UTC
(In reply to comment #8)
> For a proper fix, I'm not
> sure if we should rely on the exit code from diff, since it might vary
> depending on the diff implementation.  If we use the --text option of diff,
> then it should behave practically the same for both binary and plain text
> files.  That may be a good solution.

Actuall, --text doesn't seem to help.  Perhaps we should use sys-apps/file to check the mime type to make sure it is text/plain.
Comment 10 Zac Medico gentoo-dev 2006-11-01 01:42:51 UTC
Created attachment 100951 [details, diff]
use the diff exit code to detect two binary files that differ

It seems like the using the diff exit code as a sanity check will be good enough.  At least it's better than the current situation.  This is fixed in svn r4901.
Comment 11 Zac Medico gentoo-dev 2006-11-02 15:44:09 UTC
This has been released in 2.1.2_rc1-r3.
Comment 12 Zac Medico gentoo-dev 2007-08-10 20:46:19 UTC
*** Bug 100066 has been marked as a duplicate of this bug. ***