File conflict when upgrading package

Panu Matilainen pmatilai at
Mon Nov 18 08:48:44 UTC 2013

On 11/18/2013 10:27 AM, Florian Weimer wrote:
> On 11/18/2013 12:44 AM, Mattias Ellert wrote:
>> sön 2013-11-17 klockan 22:12 +0100 skrev Sandro Mani:
>>> Upgrading from xflr5-6.09.05-4.fc21.x86_64 to
>>> xflr5-6.09.05-5.fc21.x86_64 however fails with
>>> Transaction check error:
>>>      file /usr/share/applications/xflr5.desktop from install of
>>> xflr5-6.09.05-5.fc21.x86_64 conflicts with file from
>>> package xflr5-6.09.05-4.fc21.x86_64
>> You are replacing a directory with an ordinary file. The requires a
>> %pretrans script. %pretrans scripts must be written in lua:
>> %pretrans -p <lua>
>> st = posix.stat("%{_datadir}/applications/%{name}.desktop")
>> if st and st.type == "directory" then
>>    os.execute("rm -rf %{_datadir}/applications/%{name}.desktop")
>> end
> Wow.  Shouldn't RPM support this out of the box?

Should? Sure, it seems like an obvious thing on the surface, but 
replacing directories within a transaction is very complicated due to 
removals happening after installs (and rpm's file fingerprinting semantics).

The new thing here is that rpm >= 4.11 detects and reports the 
(unsupported) attempt to replace a directory with something else as a 
conflict, previously it just barfed up with "cpio: rename failed - Is a 
directory" error in middle of transaction.

An easier-than-pretrans-hack workaround is to just use a different 
filename for the file replacing the directory.

	- Panu -

More information about the devel mailing list