How to change permissions on a directory without meaning to... - include/exclude semantics

jw schultz jw at pegasys.ws
Wed Oct 8 04:38:43 EST 2003


On Tue, Oct 07, 2003 at 11:04:42AM -0700, Wayne Davison wrote:
> On Tue, Oct 07, 2003 at 10:45:13AM -0700, jw schultz wrote:
> > Also, it is incorrect.  The trailing slash means the contents of the
> > directory (excluding .).
> 
> Nope.  The code specifically adds the '.' dir to the list of files to
> send, which is why the attributes get sent and why recursion occurs.
> The verbose output even mentions "./" explicitly when it updates the
> attributions, so this is not something that is hidden from the user.
> 
> > What i was talking about regarding a documentation addition was
> > something discussing the root dir ("/") which is more awkward to to
> > specify copy the contents but not the directory.
> 
> There's no difference between copying "/dir/" and "/" in how rsync
> treats it.  The only difference with "/" is that you can't copy this
> directory by name.  "Copy the contents" always copies the directory, so
> I don't see what you mean by "copy the contents and not the directory".

Looks like i got on a conceptual merry-go-round.

	a trailing slash on the source changes this behaviour
	to transfer all files from the directory src/bar on
	the machine foo into the /data/tmp/.  A trailing /
	on a source name means "copy the contents of this
	directory".  Without a trailing slash it means "copy
	the directory".

The way i read that is that if i do
	rsync -a /foo/bar/ /sna/
the contents (files and subdirs) of /foo/bar will be
copy/synced into /sna so that /foo/bar/sol would be synced
with /sna/sol but /sna would not have its attributes
altered to match /foo/bar.  This is evidently incorrect.

I'd say the paragraph needs an overhaul.  I'd stay away from
talking about dot for confusion's sake even if accurate.
What the trailing slash on the source path appears to be
doing is not altering the behaviour regarding the source but
rather the behaviour regarding the destination.
	
	no-slash == dir is subdir of dest path
	slash == dir is dest path

	rsync -a foo bar == rsync -a foo/ bar/foo

Were i creating this from scratch i would not have given it
this behaviour.  I also would have made it cognisant of the
trailing slash on the destination.  But, it is what it is
so if we can improve the documentation all the better.

One thought would be to make it aware of the trailing slash
on the destination path and have it not update that
directory if so indicated.  That would have given Mr. Small
another option to avoid modifying /tmp.




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

		Remember Cernan and Schmitt



More information about the rsync mailing list