Bug 108486

Summary: rdist deletes destination directory tree when only one source file is specified
Product: [Retired] Red Hat Linux Reporter: Stefan Hudson <hudson>
Component: rdistAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 9CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-18 15:16:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Hudson 2003-10-29 23:19:02 UTC
Description of problem:
When a single source file is specified for an install, rdist will delete the
entire remote directory tree specified and attempt to replace it with the source
file.

Version-Release number of selected component (if applicable):
rdist-6.1.5-26

How reproducible:
100% using this example distfile:
----- BOF -----
TESTFILE = ( filea )
${TESTFILE} -> mytarget
install /root/testdir/ ;
----- EOF -----

Steps to Reproduce:
1. Place above distfile in current directory on source system.
2. Create target directory tree /root/testdir/ on remote system with any files
in it "filea", "fileb", "filec".
3. Create a file "filea" on source system.
4. Run rdist in directory containing "distfile" and "filea".

Actual results:
[root@mysource]# rdist -P /usr/bin/ssh
mytarget: updating host mytarget
mytarget: filea: updating
mytarget: /root/testdir//filea: removed
mytarget: /root/testdir//fileb: removed
mytarget: /root/testdir//filec: removed
mytarget: /root/testdir//rdistjCQXPO: removed
mytarget: /root/testdir/: removed
mytarget: REMOTE ERROR: /root/testdir/rdistjCQXPO -> /root/testdir/: rename
failed: No such file or directory
mytarget: updating of mytarget finished

Expected results:
[root@mysource]# rdist -P /usr/bin/ssh
mytarget: updating host mytarget
mytarget: filea: updating
mytarget: updating of mytarget finished

Additional info:
If more than one source file is specified, behavior is correct:
Example distfile:
----- BOF -----
TESTFILE = ( filea fileb )
${TESTFILE} -> mytarget
install /root/testdir/ ;
----- EOF -----

[root@mysource]# rdist -P /usr/bin/ssh
mytarget: updating host mytarget
mytarget: filea: updating
mytarget: fileb: updating
mytarget: updating of mytarget finished

This is a good way to wipe out /etc on important machines.
rdist should never remove any files unless remove option is specified.

Comment 1 Phil Knirsch 2003-12-17 12:50:25 UTC
Reproduced locally here, investigating.

Read ya, Phil

Comment 2 Phil Knirsch 2003-12-17 12:51:31 UTC
PS: This sounds a little like #210, one of the oldest bugs in
bugzilla. Just a nice little piece of history. :-)

Comment 3 Phil Knirsch 2004-01-12 15:25:09 UTC
Another note now after my vacation:

It seems like this could be similar to the behaviour of 'cp' where if
you only specify 1 source and 1 target the source file will be copied
over as a file to the target. But of course if the target already
exists as a directory then cp copies the file into that directory
which is the expected behaviour of rdist, too.

I'll see if i can work out a fix.

Read ya, Phil

Comment 4 Phil Knirsch 2004-10-18 15:16:48 UTC
Package has been fixed for AS2.1 and RHEL3 as well as latest Fedora
Core  releases.

Read ya, Phil