Bug 3527 - rsync: tries to chdir() into a device
Summary: rsync: tries to chdir() into a device
Status: CLOSED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.6
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-20 00:53 UTC by philipp.marek
Modified: 2006-03-12 02:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description philipp.marek 2006-02-20 00:53:35 UTC
With the following test-script I get an error of ENOTDIR; see
below for strace. It runs on an shmfs, and that may be some cause 
for that bug, because previously it ran on a normal ext3 partition and
I didn't see this message.


The script makes some files, devices, symlinks and directories; then changes
the type of nearly all entries and tries to combine them.

    #!/bin/bash
    mkdir typechange
    (
     cd typechange
    
     for i in 1 2 3 4
     do
    	 echo file > file-$i
    	 cp -a /dev/zero device-$i
    	 ln -s file-$i symlink-$i
    	 mkdir dir-$i
    	 echo sub > dir-$i/sub-entry
     done
    )
    
    mkdir target
    (
     cd target
    
     for i in file device symlink dir
     do
    	 echo file > $i-1
    	 cp -a /dev/zero $i-2
    	 ln -s $i-1 $i-3
    	 mkdir $i-4
    	 echo sub > $i-4/sub-entry
     done
    )

    rsync -a -n --stats --delete typechange target


Here's the annotated strace:

Starting ...
6517  16:17:41.965845 execve("/bin/sh", ["sh", "-c", "LANG=C rsync -n --delete -a --st"...], [/* 34 vars */] <unfinished ...>
... finding the entry
6517  16:17:42.156937 select(6, [5], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
6517  16:17:42.157065 read(5, "typechange/device-4", 19) = 19
6517  16:17:42.157182 write(1, "deleting typechange/device-4\n", 29) = 29
6517  16:17:42.157298 select(6, [5], [], NULL, {60, 0} <unfinished ...>
6518  16:17:42.157385 time(NULL)        = 1135005462
6518  16:17:42.157496 munmap(0x401f6000, 266240) = 0
6518  16:17:42.157611 munmap(0x40237000, 135168) = 0

Here the entry is lstat()ed:
6518  16:17:42.157724 lstat64("typechange/device-4", {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 5), ...}) = 0
And directly afterwars an opendir() is called:
6518  16:17:42.157889 open("typechange/device-4", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY) = -1 ENOTDIR (Not a directory)

rsync continues nonetheless ...
6518  16:17:42.158268 select(4, [3], [1], NULL, {60, 0}) = 1 (out [1], left {60, 0})
6518  16:17:42.158426 write(1, "O\0\0\10rsync: opendir \"/tmp/ram/wc2"..., 83 <unfinished ...>
6517  16:17:42.158532 <... select resumed> ) = 1 (in [5], left {60, 0})
6518  16:17:42.158606 <... write resumed> ) = 83
6517  16:17:42.158677 read(5, "O\0\0\10", 4) = 4
6517  16:17:42.158792 select(6, [5], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
6517  16:17:42.158918 read(5, "rsync: opendir \"/tmp/ram/wc2/typ"..., 79) = 79
6517  16:17:42.159044 write(2, "rsync: opendir \"/tmp/ram/wc2/typ"..., 79) = 79
6517  16:17:42.159553 select(6, [5], [], NULL, {60, 0} <unfinished ...>
6518  16:17:42.159647 time(NULL)        = 1135005462
6518  16:17:42.159780 select(4, [3], [1], NULL, {60, 0}) = 1 (out [1], left {60, 0})

And gives an error:
6518  16:17:42.159913 write(1, "/\0\0\tIO error encountered -- skip"..., 51 <unfinished ...>
6517  16:17:42.160542 <... select resumed> ) = 1 (in [5], left {59, 990000})
6518  16:17:42.160669 <... write resumed> ) = 51
6517  16:17:42.160741 read(5, "/\0\0\t", 4) = 4
6517  16:17:42.160861 select(6, [5], [], NULL, {60, 0}) = 1 (in [5], left {60, 0})
6517  16:17:42.160987 read(5, "IO error encountered -- skipping"..., 47) = 47
6517  16:17:42.161113 write(1, "IO error encountered -- skipping"..., 47) = 47
6517  16:17:42.161238 select(6, [5], [], NULL, {60, 0} <unfinished ...>
... and finished with an error.
6517  16:17:42.244334 waitpid(6518, 0xbfcb8f18, WNOHANG) = -1 ECHILD (No child processes)
6517  16:17:42.244468 getpid()          = 6517
6517  16:17:42.244570 kill(6518, SIGUSR1) = -1 ESRCH (No such process)
6517  16:17:42.244690 write(2, "rsync error: some files could no"..., 74) = 74
6517  16:17:42.245154 munmap(0x40017000, 4096) = 0
6517  16:17:42.245294 exit_group(23)    = ?


Regards,

Phil
Comment 1 philipp.marek 2006-02-20 00:55:35 UTC
Sorry, I just saw the answer in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=344113.

Will mark bug as fixed, reopen if necessary.


Regards,

Phil