Bug 231022 - yum overwrites conflicting files instead of failing
yum overwrites conflicting files instead of failing
Status: CLOSED WORKSFORME
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
6
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Paul Nasrat
http://bugs.centos.org/view.php?id=1725
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-05 12:23 EST by Jack Perdue
Modified: 2015-10-03 12:25 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-03-13 06:46:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jack Perdue 2007-03-05 12:23:52 EST
Description of problem:

If two packages (inadvertantly) have a common file, yum will allow both
to be installed and will overwrite the first installed packaage's file(s)
with the second package's file(s). 

Version-Release number of selected component (if applicable):

yum-2.4.1-1.fc4 on FC4 and yum-2.6.1-0.fc5 on FC5

How reproducible:

Very.

Steps to Reproduce:

I have the following foo.spec:

$ cat foo.spec
Name: foo
Summary: test case for yum bug
Version: 0
Release: 1
License: GPL
Group: Development/Tools
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot

%description
foo

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/bin
echo "echo foo" > %{buildroot}/usr/bin/fubar.sh
chmod 755 %{buildroot}/usr/bin/fubar.sh

%clean
rm -rf %{buildroot}

%files
%{_bindir}/fubar.sh

I create bar.spec with:

  cat foo.spec | sed 's/foo/bar/g' > bar.spec

then I build RPMs for them:

  rpmbuild -ba foo.spec bar.spec

now I have two RPMs that share the file /usr/bin/fubar.sh.

I then drop it into my local repo and run createrepo to update.

Then, on a system that uses that repo, I do:

 yum install foo
 yum install bar

yum issues absolutely no warning/error and happily overwrites foo's fubar.sh
with bar's fubar.sh. 
  
Actual results:

$ /usr/bin/fubar.sh
bar
$ rpm -V bar
$ rpm -V foo
..5..... /usr/bin/fubar.sh

Expected results:

Failure to install foo along the lines of:

Transaction Check Error: file /usr/bin/fubar.sh from install of bar-0-1
conflicts with file from package foo-0-1

Additional info:

This was originally reported to CentOS here:

  http://bugs.centos.org/view.php?id=1725

Testing by the CentOS maintainer indicates this doesn't happen 
with yum.x86_64, but does with yum.i386.  See the CentOS report
for details.
Comment 1 Paul Nasrat 2007-03-13 06:46:59 EDT
Testing on i386:

sudo rpm -ivh --test ../RPMS/testfoo-0-1.i386.rpm ../RPMS/testbar-0-1.i386.rpm 
Preparing...                ########################################### [100%]
        file /usr/bin/fubar.sh conflicts between attempted installs of
testfoo-0-1 and testbar-0-1

yum localinstall testfoo.rpm testbar.rpm
Transaction Check Error:   file /usr/bin/fubar.sh conflicts between attempted
installs of testfoo-0-1 and testbar-0-1

rpm -ivh testfoo.rpm and use yum localinstall testbar.rpm:

Transaction Check Error:   file /usr/bin/fubar.sh from install of testbar-0-1
conflicts with file from package testfoo-0-1

Comment 2 Marcin Deranek 2008-07-16 06:18:27 EDT
That's correct as:

bash# yum -d 0 -y localinstall foo-0-1.i386.rpm bar-0-1.i386.rpm 

Transaction Check Error:   file /usr/bin/fubar.sh conflicts between attempted
installs of foo-0-1 and bar-0-1

But:

bash# yum -d 0 -y localinstall foo-0-1.i386.rpm 
bash# yum -d 0 -y localinstall bar-0-1.i386.rpm 
bash# echo $?
0
bash# rpm -q -f /usr/bin/fubar.sh
foo-0-1
bar-0-1

I got these results on i386 with yum-2.6.1
Comment 3 seth vidal 2008-07-17 12:37:53 EDT
The only thing I can tell you here is to upgrade:

1. fc6 hasn't been supported in quite some time, now
2. yum 2.6.1 is ancient

Comment 4 sigdkc 2015-10-03 12:25:56 EDT
When yum gets a TransactionSet from rpm, it has a variable that yum expects to be zero but isn't. You can set it to zero directly after creating a TransactionSet:

--- yum-2.4.3/rpmUtils/transaction.py	2005-03-27 06:42:09.000000000 +0200
+++ yum-2.4.3p/rpmUtils/transaction.py	2015-10-03 01:30:23.000000000 +0200
@@ -41,6 +41,7 @@
                          'next',
                          'clean']
         self.tsflags = []
+        self.ts.setProbFilter(0)
 
     def __getattr__(self, attr):
         if attr in self._methods:

Note You need to log in before you can comment on or make changes to this bug.