Rpm doesn't replace symbolic links during upgrade

Elan Ruusamäe glen at pld-linux.org
Sat Apr 20 12:28:37 CEST 2013

On 19.04.2013 21:15, Kacper Kornet wrote:
> Why did rpm preserve the wrong symbolic link during upgrade? I would
> expect it to remove it and recreate /tmp/dir as proper directory.
this behaviour of rpm not replacing dirs vs links, is old as rpm itself 
i believe. jbj can probably throw in some good links from mailinglists 
why and why not.

my random guess it's mostly due to have local sysadmin possibility to 
locate directory resources to different partition, i.e replace /var/log 
with a symlink to /mnt/hugepart, and not make rpm upgrade providing 
/var/log dir destroy that setup.

roughly speaking, rpm is not making distinction of linktodir and dir 
(lstat vs stat) calls

if you need to convert dir to link, then it's usually done in %pretrans 
(not %pre), see logrotate, iceweasel, libreoffice, etc for examples.


More information about the pld-devel-en mailing list