#1139 How to replace a symlink with a directory
Opened 3 years ago by remi. Modified 2 years ago

Trying the way described in the documentation
https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/

Using DNF

# dnf update
...
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Error: Transaction test error:
  file /usr/share/wordpress/wp-includes/PHPMailer/Exception.php from install of wordpress-5.8.2-2.fc35.remi.noarch conflicts with file from package php-phpmailer6-6.5.3-1.fc35.remi.noarch
  file /usr/share/wordpress/wp-includes/PHPMailer/PHPMailer.php from install of wordpress-5.8.2-2.fc35.remi.noarch conflicts with file from package php-phpmailer6-6.5.3-1.fc35.remi.noarch
  file /usr/share/wordpress/wp-includes/PHPMailer/SMTP.php from install of wordpress-5.8.2-2.fc35.remi.noarch conflicts with file from package php-phpmailer6-6.5.3-1.fc35.remi.noarch

Works with rpm -Uvh

# rpm -Uvh /var/lib/mock/fc35x/wordpress-5.8.2-2.fc35.remi.noarch.rpm 
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:wordpress-5.8.2-2.fc35.remi      ################################# [ 50%]
Cleaning up / removing...
   2:wordpress-5.8.2-1.fc35.remi      ################################# [100%]

If I remember correctly, the "recommended" way to do this (with the scriptlet documented in the packaging guidelines) broke at some point, and nobody figured out how to do this nicely and update the documentation accordingly :(

Can we at least add a warning to the docs to say "this used to work but it no longer does"?

My recollection is that the now-broken recommended way of doing this came from the RPM folks. And I don't think what's there is broken because of an issue with RPM (because rpm -U upgrades without issues), but because DNF is checking for conflicts and doesn't understand that the %pretrans scriptlet will fix them.

So I'm not sure what to do.

Metadata Update from @churchyard:
- Issue assigned to churchyard

2 years ago

I've had this trouble couple years ago in python-notebook. See the commits:

https://src.fedoraproject.org/rpms/python-notebook/c/88d75c6cd5dedb2df00126ce75ee738778563c00?branch=rawhide
https://src.fedoraproject.org/rpms/python-notebook/c/89be135877952b931c3cb6d736a55eb69f6038d9?branch=rawhide

It did not work. I've tracked it in https://bugzilla.redhat.com/show_bug.cgi?id=1787079 and asked at https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/YWJWLXKLF6DGT7LITBC766QW7RY7OOPM/ -- at the end, the solution was proposed by Panu: https://bugzilla.redhat.com/show_bug.cgi?id=1787079#c8

tl;dr this only works when the package that owned the target of that symbolic link is removed in the same transaction. If you need to do this because the package that owned the target is retired, obsolete it. If you need to do this for a different reason... no idea.

FWIW, I think that piling up workarounds upon workarounds is just a bad solution for this.
rpm should handle this internally, and just allow replacing a directory by a symlink and vice versa without any scripting in the package. We'll all be better off this way.

Well, sure, but from the packaging committee's perspective, we have to live with the RPM we have. It's either down to hacks or saying "you can never do this". If a future version of RPM is able to do this properly then we will of course make a note of that.

Log in to comment on this ticket.

Metadata