Re: cannot create .hosts.b0WX1x : File exists
On Fri, Nov 30, 2001 at 12:08:19AM +0100, Rok Krulec wrote: Hello Dave, What version of sources is that which had mkstemp at line 121 of syscall.c? It's surprising that you could just replace one with the other, as mkstemp is supposed to open the file and mktemp is not supposed to. It sounds like you have some inconsistent version of the sources. rsync --version returns: rsync version 2.4.6 protocol version 24 Rsync 2.4.6 did not use mkstemp at all. A comment in receiver.c says mktemp is deliberately used here instead of mkstemp. and line 120 of syscall.c calls mktemp. I suspect you had a locally hacked version of rsync source in which someone changed the mktemp call to mkstemp, and you just changed it back. I don't have any 2.4 kernel systems with libc-2.2.1, but I tried a 2.4 kernel with a later libc and mktemp and mkstemp worked as expected. Ah, I bet I know what happened. I see that gcc warns when you use mktemp: the use of `mktemp' is dangerous, better use `mkstemp' so somebody person must have thought they could just replace one with the other without looking at the man page. - Dave Dykstra
Re: cannot create .hosts.b0WX1x : File exists
Hello Dave, On Thu, 29 Nov 2001, Dave Dykstra wrote: What version of rsync are you using? The cannot create message is coming from receiver.c. Assuming you're using a released version of rsync and not a development version, it appears that the mktemp library call is creating the file and rsync isn't expecting that. Are you sure the Linuxes are exactly the same; do you perhaps have a different version of libc on that one machine (I'm guessing that maybe mktemp has been changed to create the file instead of just returning its name)? Andrew Tridgell changed the relevant section of code in the development version of rsync 6 months ago to use mkstemp (when configure determines it to be secure) instead of mktemp but he didn't say why. This is it. All working machines have 2.2 lnx kernel and libc-2.1.3.so nonworking one has 2.4 lnx kernel and libc-2.2.1.so. I changed line 121 of syscall.c to use: mktemp(template); instead of mkstemp(template); I got his linker warning, but rsync was linked OK and is working fine now. syscall.o: In function `do_mktemp': syscall.o(.text+0x32f): the use of `mktemp' is dangerous, better use `mkstemp' Dave, thank You for Your help. You guys are really great. Rok Krulec Portoroz/Slovenia, 29.Nov 2001 @ 23:12 CET Public GnuPG key @ http://rok.fpp.edu/pgp.key On Thu, Nov 29, 2001 at 12:34:04AM +0100, Rok Krulec wrote: Hello Dave, thank You for Your time; sorry I didn't included my rsyncd.conf. As I said, on two other machines with EXACTLY the same config file and EXACTLY the same passwd entries for nobody and nogroup = same ID's, it works perfectly. EXECTLY the same permissions on target directory alos ofcourse. This is my /etc/rsyncd.conf: --- CUT HERE --- motd file = /etc/issue.net max connections = 0 syslog facility = local3 [bkp] comment = Backup area path = /_silos read only = no list = no uid = nobody gid = nogroup hosts allow = XXX.XXX.XXX.XXX --- CUT HERE --- Portoroz/Slovenia, 29.Nov 2001 @ 00:24 CET Public GnuPG key @ http://rok.fpp.edu/pgp.key On Wed, 28 Nov 2001, Dave Dykstra wrote: You probably need to set read only = no in rsyncd.conf. - Dave On Wed, Nov 28, 2001 at 04:29:35PM +0100, Rok Krulec wrote: Hello, when I do: /opt/rsync/bin/rsync /etc/hosts targethost::bkp/ I get: cannot create .hosts.b0WX1x : File exists I check the targethost and I get empty file .hosts.b0WX1x When trying with other targethost-s it works, but on this one it doesn't. On the other targethosts I have exactly the same LinuX distribution, permissions and users than on the problem targethost. I have exactly the same configuration than on the other machines, except on probelm targethost I have SCSI hard disk. When i strace the rsync --deamon i get: 4697 open(.hosts.b0WX1x, O_RDWR|O_CREAT|O_EXCL|0x8000, 0600) = 4 4697 open(.hosts.b0WX1x, O_WRONLY|O_CREAT|O_EXCL|0x8000, 0600) = -1 EEXIST (File exists) It seems like it opens the file ReadWrite and then tries to open it readonly. I don't know why. It bangs then. Thanks for any hint, Rok Krulec
Re: cannot create .hosts.b0WX1x : File exists
On Thu, Nov 29, 2001 at 11:46:30PM +0100, Rok Krulec wrote: Hello Dave, On Thu, 29 Nov 2001, Dave Dykstra wrote: What version of rsync are you using? The cannot create message is coming from receiver.c. Assuming you're using a released version of rsync and not a development version, it appears that the mktemp library call is creating the file and rsync isn't expecting that. Are you sure the Linuxes are exactly the same; do you perhaps have a different version of libc on that one machine (I'm guessing that maybe mktemp has been changed to create the file instead of just returning its name)? Andrew Tridgell changed the relevant section of code in the development version of rsync 6 months ago to use mkstemp (when configure determines it to be secure) instead of mktemp but he didn't say why. This is it. All working machines have 2.2 lnx kernel and libc-2.1.3.so nonworking one has 2.4 lnx kernel and libc-2.2.1.so. I changed line 121 of syscall.c to use: mktemp(template); instead of mkstemp(template); I got his linker warning, but rsync was linked OK and is working fine now. syscall.o: In function `do_mktemp': syscall.o(.text+0x32f): the use of `mktemp' is dangerous, better use `mkstemp' Dave, thank You for Your help. You guys are really great. What version of sources is that which had mkstemp at line 121 of syscall.c? It's surprising that you could just replace one with the other, as mkstemp is supposed to open the file and mktemp is not supposed to. It sounds like you have some inconsistent version of the sources. - Dave
Re: cannot create .hosts.b0WX1x : File exists
Hello Dave, What version of sources is that which had mkstemp at line 121 of syscall.c? It's surprising that you could just replace one with the other, as mkstemp is supposed to open the file and mktemp is not supposed to. It sounds like you have some inconsistent version of the sources. rsync --version returns: rsync version 2.4.6 protocol version 24 Rok Krulec Portoroz/Slovenia, 30.Nov 2001 @ 00:03 CET Public GnuPG key @ http://rok.fpp.edu/pgp.key
Re: cannot create .hosts.b0WX1x : File exists
You probably need to set read only = no in rsyncd.conf. - Dave On Wed, Nov 28, 2001 at 04:29:35PM +0100, Rok Krulec wrote: Hello, when I do: /opt/rsync/bin/rsync /etc/hosts targethost::bkp/ I get: cannot create .hosts.b0WX1x : File exists I check the targethost and I get empty file .hosts.b0WX1x When trying with other targethost-s it works, but on this one it doesn't. On the other targethosts I have exactly the same LinuX distribution, permissions and users than on the problem targethost. I have exactly the same configuration than on the other machines, except on probelm targethost I have SCSI hard disk. When i strace the rsync --deamon i get: 4697 open(.hosts.b0WX1x, O_RDWR|O_CREAT|O_EXCL|0x8000, 0600) = 4 4697 open(.hosts.b0WX1x, O_WRONLY|O_CREAT|O_EXCL|0x8000, 0600) = -1 EEXIST (File exists) It seems like it opens the file ReadWrite and then tries to open it readonly. I don't know why. It bangs then. Thanks for any hint, Rok Krulec Portoroz/Slovenia, 28.Nov 2001 @ 15:34 CET Public GnuPG key @ http://rok.fpp.edu/pgp.key Portoroz, 28.Nov 2001 @ 15:39 CET Public GnuPG key @ http://rok.fpp.edu/pgp.key