Bug 494640 - Symlinks are removed when listed as %_netsharedpath
Summary: Symlinks are removed when listed as %_netsharedpath
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: rpm
Version: 5.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Florian Festi
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 668957
TreeView+ depends on / blocked
 
Reported: 2009-04-07 17:07 UTC by Olivier Fourdan
Modified: 2018-12-01 19:05 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-23 12:10:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Proposed patch (540 bytes, patch)
2009-04-07 17:07 UTC, Olivier Fourdan
no flags Details | Diff
Test package to reproduce the issue (release 1) (2.66 KB, application/x-rpm)
2009-04-07 17:09 UTC, Olivier Fourdan
no flags Details
Test package to reproduce the issue (release 2) (2.73 KB, application/x-rpm)
2009-04-07 17:10 UTC, Olivier Fourdan
no flags Details
Source rpm of the above reproducer help package (1.83 KB, application/x-rpm)
2009-04-07 17:11 UTC, Olivier Fourdan
no flags Details
Source of the updated version (1.92 KB, application/x-rpm)
2009-04-07 17:12 UTC, Olivier Fourdan
no flags Details

Description Olivier Fourdan 2009-04-07 17:07:20 UTC
Created attachment 338536 [details]
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 :)

Comment 1 Olivier Fourdan 2009-04-07 17:09:04 UTC
Created attachment 338537 [details]
Test package to reproduce the issue (release 1)

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

Comment 2 Olivier Fourdan 2009-04-07 17:10:01 UTC
Created attachment 338538 [details]
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.

Comment 4 Olivier Fourdan 2009-04-07 17:11:58 UTC
Created attachment 338539 [details]
Source rpm of the above reproducer help package

Comment 5 Olivier Fourdan 2009-04-07 17:12:56 UTC
Created attachment 338540 [details]
Source of the updated version

Comment 9 RHEL Program Management 2009-04-21 09:45:18 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.

Comment 12 David Goldberg 2009-06-04 19:16:17 UTC
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.

Comment 13 Panu Matilainen 2009-06-05 06:37:42 UTC
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

Comment 14 Florian Festi 2009-09-10 10:16:34 UTC
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

Comment 17 RHEL Program Management 2009-11-06 18:53:07 UTC
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 "?".

Comment 19 RHEL Program Management 2010-08-09 18:50:22 UTC
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.

Comment 22 RHEL Program Management 2011-05-31 14:00:59 UTC
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.

Comment 23 Panu Matilainen 2011-08-23 12:10:51 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.