RPM

Symlinks are removed when listed as %_netsharedpath

Bug #651438 reported by Jeff Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
RPM
Confirmed
Wishlist
Jeff Johnson
Fedora
Fix Released
Medium

Bug Description

tracker

Revision history for this message
In , Olivier (olivier-redhat-bugs) wrote :

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:
  /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 :)

Revision history for this message
In , Olivier (olivier-redhat-bugs) wrote :

Created attachment 338537
Test package to reproduce the issue (release 1)

This is the first package to install, as described in the reproducer steps.

Revision history for this message
In , Olivier (olivier-redhat-bugs) wrote :

Created attachment 338538
Test package to reproduce the issue (release 2)

The test package to upgrade, after havong replaced one of the directories by a symlink, as described in the reproducer steps.

Revision history for this message
In , Olivier (olivier-redhat-bugs) wrote :

Created attachment 338539
Source rpm of the above reproducer help package

Revision history for this message
In , Olivier (olivier-redhat-bugs) wrote :

Created attachment 338540
Source of the updated version

Revision history for this message
In , RHEL (rhel-redhat-bugs) wrote :

Development Management has reviewed and declined this request. You may appeal
this decision by reopening this request.

Revision history for this message
In , David (david-redhat-bugs) wrote :

This is an issue for us. /usr/local is a symbolic link to a network share (actually AFS but that's not relevant). I was told about this bug in response to a customer service ticket (#1923712) and sure enough, adding /usr/local:/var/spool/mail as %_netsharedpath allows the filesystem package to install but removes the link. We have a workaround as our cfengine configuration replaces the link but would prefer to allow rhnsd to handle updates rather than running yum update through cfengine to avoid a gap. If it is possible to fix, please do.
Thanks.

Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

The issue is that %_netsharedpath as currently implemented doesn't work
"after the fact". In order to function as expected, %_netsharedpath needs to be
in effect when the package is first installed. This way the "skipnetshared"
state gets recorded into rpmdb and erasure (on upgrade or otherwise) knows to
leave it alone.

Getting %_netsharedpath defined for initial install in anaconda might be tricky/impossible, I dont remember the exact details of what can be done in kickstart %pre. It should be possible to work around it later with something like

# echo "%_netsharedpath /usr/local:/var/spool/mail" > /etc/rpm/macros.netshared
# rpm -e --justdb --nodeps filesystem
# rpm -Uvh /path/to/filesystem.rpm

Revision history for this message
In , Florian (florian-redhat-bugs) wrote :

Right now filtering files in netsharedpath is done in skipFiles() (transaction.c) which is only run for to be installed packages as it also filters for other cases.
Solution is to move the netsharedpath into an own function that is run for all packages.h

Revision history for this message
In , RHEL (rhel-redhat-bugs) wrote :

This request was evaluated by Red Hat Product Management for
inclusion, but this component is not scheduled to be updated in
the current Red Hat Enterprise Linux release. If you would like
this request to be reviewed for the next minor release, ask your
support representative to set the next rhel-x.y flag to "?".

Revision history for this message
In , RHEL (rhel-redhat-bugs) wrote :

This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated in the
current release, Red Hat is unfortunately unable to address this
request at this time. Red Hat invites you to ask your support
representative to propose this request, if appropriate and relevant,
in the next release of Red Hat Enterprise Linux.

Jeff Johnson (n3npq)
tags: added: install netsharedpath symlink
Revision history for this message
Jeff Johnson (n3npq) wrote :

%_netsharedpath is mapped into NOTINSTALLED. A dynamic
file state reassignment during removal is likely the best approach.

Changed in rpm:
status: New → Confirmed
importance: Undecided → Wishlist
assignee: nobody → Jeff Johnson (n3npq)
Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

NAK. This has been fixed upstream but backporting the largish patch to the old and rather different rpm codebase in RHEL 5 is too risky at this point.

The rpm version in RHEL 6 does include the fix for this issue though, closing NEXTRELEASE.

Changed in fedora:
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.