Specifying a directory as %_netsharedpath in /etc/rpm/macros.nfs can avoid breaking the upgrade of a package that accesses that path, but if the path is replaced by a symlink, the symlink is removed during the upgrade which is not expected either.
Version-Release number of selected component (if applicable):
rpm-4.4.2.3
How reproducible:
100% reproducible
Steps to Reproduce:
1. install the test package provided, that wil lcreate the following directories:
/opt/myfs/dir{1,2,3,4,5}
2. replace one of the direcotries by a symlink to an NFS mounted directory
mv /opt/myfs/dir1 /opt/myfs/dir1.orig && ln -s /test /opt/myfs/dir1
3. Add /opt/myfs/dir1 among to the list of netsharedpath in /etc/rpm/macros.nfs
echo '%_netsharedpath /opt/myfs/dir1' > /etc/rpm/macros.nfs
4. Upgrade the test package myfs
rpm -Uvh myfs-1.0.0-2.i386.rpm
Actual results:
The link /opt/myfs/dir1 has been removed
Expected results:
The link /opt/myfs/dir1 is left untouched
Additional info:
The link is removed in lib/fsm.c by fsmStage().
The proposed patch checks if the link is actually listed as netsharedpath and skip its removal if listed. Please note that even if this patch works, it may have other side effects that I might not have overseen :)
Created attachment 338536
Proposed patch
Description of problem:
Specifying a directory as %_netsharedpath in /etc/rpm/macros.nfs can avoid breaking the upgrade of a package that accesses that path, but if the path is replaced by a symlink, the symlink is removed during the upgrade which is not expected either.
Version-Release number of selected component (if applicable):
rpm-4.4.2.3
How reproducible:
100% reproducible
Steps to Reproduce:
1. install the test package provided, that wil lcreate the following directories: myfs/dir{ 1,2,3,4, 5} 0.0-2.i386. rpm
/opt/
2. replace one of the direcotries by a symlink to an NFS mounted directory
mv /opt/myfs/dir1 /opt/myfs/dir1.orig && ln -s /test /opt/myfs/dir1
3. Add /opt/myfs/dir1 among to the list of netsharedpath in /etc/rpm/macros.nfs
echo '%_netsharedpath /opt/myfs/dir1' > /etc/rpm/macros.nfs
4. Upgrade the test package myfs
rpm -Uvh myfs-1.
Actual results:
The link /opt/myfs/dir1 has been removed
Expected results:
The link /opt/myfs/dir1 is left untouched
Additional info:
The link is removed in lib/fsm.c by fsmStage().
The proposed patch checks if the link is actually listed as netsharedpath and skip its removal if listed. Please note that even if this patch works, it may have other side effects that I might not have overseen :)