Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 584906 - rdist deletes destination directory tree when only one source file is specified
rdist deletes destination directory tree when only one source file is specified
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: rdist (Show other bugs)
4.8
All Linux
low Severity medium
: rc
: ---
Assigned To: Vojtech Vitek
BaseOS QE - Apps
:
Depends On:
Blocks: 663297 663308
  Show dependency treegraph
 
Reported: 2010-04-22 13:08 EDT by Casey Dahlin
Modified: 2015-03-04 18:56 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 663297 663308 (view as bug list)
Environment:
Last Closed: 2010-12-15 06:30:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Casey Dahlin 2010-04-22 13:08:57 EDT
Description of problem:
Destination machine, # mkdir -p /rdist/test

execte rdist to copy a single file to the destination.

[root@dhcp210-29 rdist]# rdist -o noverify,noremove  -P /usr/bin/ssh -p /usr/sbin/rdistd -c LICENSE 10.65.210.54:/rdist/test
10.65.210.54: updating host 10.65.210.54
10.65.210.54: LICENSE: updating
10.65.210.54: dhcp210-54: /rdist/test: removed
10.65.210.54: updating of 10.65.210.54 finished
[root@dhcp210-29 rdist]#

Destination machine,

[root@dhcp210-54 rdist]# ls -l /rdist/
total 8
-rw-r--r--  1 root root 6279 Apr 23  2010 test
[root@dhcp210-54 rdist]## file test
test: ASCII English text
[root@dhcp210-54 rdist]#
As you can see the destination directory got replaced with a file with the contents of LICENSE file.

The above behavior is normal. (if there is no trailing / then rdist treat the last part as the file name).

Now execute the same commands with trailing /  (removed the file from destination box, created the directory /rdist/test)

[root@dhcp210-29 rdist]# rdist -o noverify,noremove  -P /usr/bin/ssh -p /usr/sbin/rdistd -c LICENSE 10.65.210.54:/rdist/test/
10.65.210.54: updating host 10.65.210.54
10.65.210.54: LICENSE: updating
10.65.210.54: dhcp210-54: /rdist/test//rdistFlfP9L: removed
10.65.210.54: dhcp210-54: /rdist/test/: removed
10.65.210.54: dhcp210-54: REMOTE ERROR: /rdist/test/rdistFlfP9L -> /rdist/test/: rename failed: No such file or directory
10.65.210.54: updating of 10.65.210.54 finished
[root@dhcp210-29 rdist]#

Note the trailing / on /rdist/test/), This time rdist removes the destination directory /rdist/test.

The removal of /rdist/test directory is a bug, if it's replaced with the content of LICENSE file (as it does when we execute without trailing /) then it's acceptable.

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

How reproducible:
Always

Additional info:
Bug appeared in AS 2.1 and RHEL 3. Bugzilla 108486. The bug was reported as being fixed. Hence the regression keyword.
Comment 5 Vojtech Vitek 2010-12-14 11:13:25 EST
There are two test cases as Casey already mentioned:

1) Without a trailing slash '/':

$ cd; touch test-file; mkdir test
$ rdist -o noverify,noremove  -P /usr/bin/ssh -p /usr/sbin/rdistd -c test-file 127.0.0.1:/home/vvitek/test
127.0.0.1: updating host 127.0.0.1
vvitek@127.0.0.1's password: 
127.0.0.1: test-file: updating
127.0.0.1: dhcp-*: /home/vvitek/test: removed
127.0.0.1: updating of 127.0.0.1 finished

This can be considered as expected behaviour (*).
Rdist just replaced the destination directory with the new file.


2) With a trailing slash '/':

$ cd; touch test-file; mkdir test
$ rdist -o noverify,noremove -P /usr/bin/ssh -p /usr/sbin/rdistd -c test-file 127.0.0.1:/home/vvitek/test/
127.0.0.1: updating host 127.0.0.1
vvitek@127.0.0.1's password: 
127.0.0.1: test-file: updating
127.0.0.1: dhcp-*: /home/vvitek/test//rdist35JjYB: removed
127.0.0.1: dhcp-*: /home/vvitek/test/: removed
127.0.0.1: dhcp-*: REMOTE ERROR: /home/vvitek/test/rdist35JjYB -> /home/vvitek/test/: rename failed: No such file or directory
127.0.0.1: updating of 127.0.0.1 finished

This is bug even if (*) was expected behaviour.
Rdist just _deleted_ the destination directory but was _not able to create_ the new file.


(*): Rdist removes destination directory with a file without any check.
Other programs, such as rsync, cp, scp and mv never do this. They always check if the destination path wasn't an existing directory (even if one provides trailing slash or not) - and if it was existing directory, they creates new file inside that directory.
Comment 7 RHEL Product and Program Management 2010-12-14 14:18:36 EST
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.

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