rsync silently changes special files to regular ones!

jw schultz jw at pegasys.ws
Mon Aug 25 17:30:19 EST 2003


On Mon, Aug 25, 2003 at 05:22:39PM +1000, Martin Pool wrote:
> On Sun, 24 Aug 2003 16:44:15 +0200
> clemens fischer <ino-qc at spotteswoode.de.eu.org> wrote:
> 
> > rsync  version 2.5.6  protocol version 26 on FreeBSD 4.8-STABLE i386
> > "promotes" character special files to regular files:
> > 
> > --8<---cut here:--start--->8--
> > # ll /dev/stdout
> > 8282 crw-rw-rw-  1 root  wheel  -  22,   1 Aug 23 17:30 /dev/stdout
> > 
> > # rsync localhost::rsync/readme /dev/stdout
> > $Id: readme,v 1.2 2003/08/05 02:38:25 root Exp root $
> > ...
> > 
> > # ll /dev/stdout
> > 7527 -rw-r--r--  1 root  wheel  - 136 Aug 24 11:49 /dev/stdout
> > 
> > # ./MAKEDEV std
> > 
> > # ll /dev/stdout
> > 7527 crw-rw-rw-  1 root  wheel  -  22,   1 Aug 24 11:49 /dev/stdout
> > --8<---cut here:---end---->8--
> > 
> > i know that this (displaying a text file on the console) is not what
> > rsync is meant to do, but since it didn't give any messages or exit-
> > codes, i didn't think of checking /dev/stdout.  since then i chased a
> > phantom bug in freebsds update procedure for two weeks, never
> > suspecting an rsync bug. 
> 
> It is not "used on" special files.  rsync replaces the destination with
> the source.
> 
> It is just the same behaviour as mv.  It is not like 'cat >dest'.
> 
> root at vexed:/tmp# mknod pts5 c 136 5
> root at vexed:/tmp# date>hello
> root at vexed:/tmp# ls -l hello pts5
> -rw-r--r--    1 root     root           29 Aug 25 17:20 hello
> crw-r--r--    1 root     root     136,   5 Aug 25 17:20 pts5
> root at vexed:/tmp# mv hello pts5
> root at vexed:/tmp# ls -l hello pts5
> ls: hello: No such file or directory
> -rw-r--r--    1 root     root           29 Aug 25 17:20 pts5
> 
> I can see how it would be confusing, but it is not a bug.
> 
> > rsync should error exit or message the user when used on special
> > files!
> 
> No, I don't think so.  At the most I could stretch to giving a warning
> when replacing a special file, but even then I'm not sure.  Unix is
> "you asked for it, you got it."

No warning is called for.  In fact is contraindicated by the
fact that rsync is expected to cope with device files so
replacing device files is well within its expected function.

-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt



More information about the rsync mailing list