mkstemp done in sub-optimal directory

Tom Goulet tomg at
Tue May 6 03:00:36 EST 2003


The remote rsync process will call the mkstemp library call whenever
it's updating (or uploading, I'm not sure) a new file.  The mkstemp call
uses a pathname that does not place the temporary file in the same
directory as the updated file.  In my case the permissions for these
directories are different, and I get a "Permission denied" error

Here is my Rsync command line:
| rsync -zrtlvessh --partial --delete --delete-after --bwlimit=8 \
|         --exclude '*.iso' \
|         /extra/library academus:/var/pub

The tomg user has no write permission for the academus:/var/pub
directory, but the tomg user has write permission for the library
directory and all its sub-directories.

I managed to run the strace utility on the server side to figure out
what was happening.  Here is a relevant block of lines:
| 6997  open("library/art/Cortès,_Edouard_Leon/mainpic.jpeg", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
| 6997  gettimeofday({1052152429, 148285}, NULL) = 0
| 6997  getpid()                          = 6997
| 6997  open(".mainpic.jpeg.Cws2Pl", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = -1 EACCES (Permission denied)
| 6997  write(6, "7\0\0\10mkstemp .mainpic.jpeg.Cws2Pl failed: Permission denied\n", 59) = 59

The remote rsync process is in the /var/pub/ directory.

By the way, this worked:
| rsync -zrtlvessh --rsync-path='/usr/bin/strace -f -o rsync.0.strace -s 64 rsync' --partial --delete --delete-after --bwlimit=8 --exclude '*.iso' /extra/library academus:/var/pub

The proper fix seems to me to be to make the temporary file in the same
directory as the file being updated, so the strace output line would
look like this:
| 6997  open("library/art/Cortès,_Edouard_Leon/.mainpic.jpeg.Cws2Pl", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 7

As a workaround I am using this command line:
| rsync -zrtlvessh --partial --delete --delete-after --bwlimit=8 \
|         --exclude '*.iso' \
|         /extra/library/ academus:/var/pub/library

Tom Goulet, tomg at, D8BAD3BC,
Internet mail politeness requires using only plain text, disallowing advertising
footers, interspersing replies in quoted text, trimming quoted text not needed
to show context, and keeping lines unbroken.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the rsync mailing list