Bug 627490 - rhncfg-client handles symlinks to directories wrong
Summary: rhncfg-client handles symlinks to directories wrong
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Clients
Version: 1.6
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space16
TreeView+ depends on / blocked
 
Reported: 2010-08-26 08:07 UTC by Sandro Mathys
Modified: 2011-12-22 16:48 UTC (History)
4 users (show)

Fixed In Version: rhncfg-5.10.20-1
Clone Of:
: 747132 (view as bug list)
Environment:
Last Closed: 2011-12-22 16:48:12 UTC
Embargoed:


Attachments (Terms of Use)
patch proposed (3.08 KB, patch)
2011-11-14 18:46 UTC, Marcelo Moreira de Mello
no flags Details | Diff

Description Sandro Mathys 2010-08-26 08:07:28 UTC
Description of problem:
If you deploy a symlink to a directory with the configuration management, that works just fine. If you try to redeploy that symlink again (without deleting the old one), it fails because rhncfg-client thinks that a directory of the same name exists already.

Version-Release number of selected component (if applicable):
rhncfg-client-5.9.19-1.fc12.noarch

How reproducible:
Always

Steps to Reproduce:
1. create a symlink /test that points to /tmp
2. deploy the symlink
3. deploy it again
  
Actual results:
# ls -ahl /test
lrwxrwxrwx. 1 root root 5 Aug 25 18:44 /test -> /tmp
# rhncfg-client-get /test
Error: unable to deploy file /test, as it is already a directory on disk

Expected results:
# rhncfg-client-get /test
Deploying /test

Additional info:
A single symlink that points to a directory completely breaks functionality of 'rhncfg-client get' (i.e. without file-parameter) and 'deploy all config files' in the WebUI because it will then not deploy all other files (rollback).

Comment 1 Jan Pazdziora (Red Hat) 2010-11-19 16:03:58 UTC
Mass-moving to space13.

Comment 2 Miroslav Suchý 2011-04-11 07:32:38 UTC
We did not have time for this one during Spacewalk 1.4 time frame. Mass moving to Spacewalk 1.5.

Comment 3 Miroslav Suchý 2011-04-11 07:36:51 UTC
We did not have time for this one during Spacewalk 1.4 time frame. Mass moving to Spacewalk 1.5.

Comment 4 Jan Pazdziora (Red Hat) 2011-07-20 11:50:36 UTC
Aligning under space16.

Comment 5 Milan Zázrivec 2011-09-16 14:25:40 UTC
Problem has been fixed in spacewalk.git master with commit
06a1f13b03f569c6a251e5fbe45069e6b8bb0c9f

Comment 7 Marcelo Moreira de Mello 2011-11-14 18:46:28 UTC
Created attachment 533600 [details]
patch proposed


 Hello team,

Here follow an complementary patch for commit 06a1f13b03f569c6a251e5fbe45069e6b8bb0c9f when handling directory symlinks.

  After applying the patch:

#rhncfg-client elist
Mode          Owner Group          Size Rev      Config Channel    File
lrwxrwxrwx root root 14 1 teste /boot/cross-dir -> /usr/local/bin lrwxrwxrwx root root 11 2 teste /boot/cross-link -> /etc/passwd -rw-r--r-- root root 15 1 teste /etc/test-file-regular lrwxrwxrwx root root 10 2 teste /root/sym-link-same-part -> /etc/hosts lrwxrwxrwx root root 4 1 teste /teste -> /tmp

#rhncfg-client verify
 missing /boot/cross-dir
 missing /boot/cross-link
 missing /etc/test-file-regular
 missing /root/sym-link-same-part
 missing /teste

#rhncfg-client get
Deploying /etc/test-file-regular
Deploying /boot/cross-link
Deploying /root/sym-link-same-part
Deploying /teste
Deploying /boot/cross-dir

#rhncfg-client verify
  /boot/cross-dir
  /boot/cross-link
  /etc/test-file-regular
  /root/sym-link-same-part
  /teste

#ls -lad /teste /boot/cross-dir
lrwxrwxrwx 1 root root 14 Nov 14 16:40 /boot/cross-dir -> /usr/local/bin
lrwxrwxrwx 1 root root  4 Nov 14 16:40 /teste -> /tmp

#rhncfg-client get
Deploying /etc/test-file-regular
Deploying /boot/cross-link
Deploying /root/sym-link-same-part
Deploying /teste
Deploying /boot/cross-dir

#ls -lad /teste /boot/cross-dir
lrwxrwxrwx 1 root root 14 Nov 14 16:41 /boot/cross-dir -> /usr/local/bin
lrwxrwxrwx 1 root root  4 Nov 14 16:41 /teste -> /tmp

#tree  /var/lib/rhncfg/backups/
/var/lib/rhncfg/backups/
|-- boot
|   |-- cross-dir.rhn-cfg-backup -> /usr/local/bin
|   `-- cross-link.rhn-cfg-backup -> /etc/passwd
|-- etc
|   `-- test-file-regular.rhn-cfg-backup
|-- root
|   `-- sym-link-same-part.rhn-cfg-backup -> /etc/hosts
`-- teste.rhn-cfg-backup -> /tmp

5 directories, 3 files


  Patch already submitted to approval at spacewalk-devel maillist. 
   
   Mail Thread: 
https://www.redhat.com/archives/spacewalk-devel/2011-November/msg00027.html

  Thank you.

   Best Regards,
mmello

Comment 8 Clifford Perry 2011-11-14 18:54:34 UTC
Based on new information, moving to ASSIGNED and needinfo on devel to review proposed patch to improve fix/solution to this bug.

Comment 9 Michael Mráka 2011-11-21 13:32:19 UTC
Well, comment #7 is missing an important piece of information - this happens when deployed symlink (e.g. /boot/cross-dir) and rhncfg backup (/var/lib/rhncfg/backup) are on different devices.

Comment 10 Michael Mráka 2011-11-21 13:32:56 UTC
Patch applied to spacewalk master as

commit e55bf36731263ba0324fc47578ab4b5ed3537b4c
    627490 - fixed cross device symlink backup
      Complementary patch for commit 06a1f13b03f569c6a251e5fbe45069e6b8bb0c9f
    
    Fixing the issue when config file and backup (/var/lib/rhncfg/backup) are
    on a different devices.

Comment 11 Milan Zázrivec 2011-12-22 16:48:12 UTC
Spacewalk 1.6 has been released.


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