On Wednesday, Feb 19, 2003, at 22:06 Europe/Vienna, David Andrews wrote:
I tried a number of different settings for the file mask includingThe atomic file creation is always a bit of a problem over network connections, especially when protocol conversions are involved. The semantics of the O_EXCL flag require that the entire operation must be done in one network request. Since this is not even possible with NFS2 (as far as I know, correct me if I'm wrong), Sharity can't map it to CIFS. And I doubt that a simple equivalent could be found in CIFS...
0700, 0600, 0500 and 0400. I also tried 0500 for the directory mask with each of these. To no avail.
However, I did figure out that it is the O_EXCL flag on the open() call that causes the problem. It is intended to make an open "exclusive" by atomically checking if the file exists and, if it does not, creating a new file. If this flag is omitted, rsync works with Sharity (albeit a small touch less securely).
I don't know how O_EXCL is implemented exactly, but we might find file system semantics which at least don't let the call fail. That would involve a bit of network debugging, though.
Here is the recipe:We have this in the archive now -- just in case somebody else comes across the same problem.
1. Download the source distribution of rsync.
2. Run the configure process.
3. Comment out the following line in config.h:
#define HAVE_SECURE_MKSTEMP 1
4. Patch the file syscall as follows:
# diff syscall.c.orig syscall.c
Add the following inside the do_mkstemp function (line 150):
int status;
Change the following line (at line 167):
return do_open(template, O_RDWR|O_EXCL|O_CREAT, perms);
to this:
status = do_open(template, O_RDWR|O_EXCL|O_CREAT, perms);
if ((status == -1) && (errno == EOPNOTSUPP))
status = do_open(template, O_RDWR|O_CREAT, perms);
return status;
This patch first tries to open the file exclusively and, if that fails because of the same incompatibility exhibited by Sharity, it tries without the exclusive flag.
If you could look into the possiblity of handling the O_EXCL flag in Sharity, it would be appreciated.I remember to have read a discussion of the problem for NFS2 and user mailboxes. The result was that there is no really good and correct solution. But if you take the time to generate a debug log of the event with nfsTrace and netbiosTrace enabled (with the daemon started in debug mode -- see the manual chapter "troubleshooting" for details), we can analyze it.
Regards, Christian.
--
Dipl.-Ing. Christian Starkjohann
Objective Development
mailto:[EMAIL PROTECTED] | http://www.obdev.at/
_______________________________________________
Sharity-talk mailing list
[EMAIL PROTECTED]
To unsubscribe see http://at.obdev.at/mailman/listinfo/sharity-talk
