search for: fnametmp

Displaying 20 results from an estimated 50 matches for "fnametmp".

2002 Jun 07
0
problem related to filename length
...Thu Feb 14 03:41:58 2002 +++ rsync-2.5.5/receiver.c Sat Jun 8 03:41:22 2002 @@ -163,10 +163,16 @@ } } +#include <sys/vfs.h> +static inline int fname_syslimit(const char* path) { + struct statfs sb; + return !statfs(path,&sb) ? sb.f_namelen : 255; +} static int get_tmpname(char *fnametmp, char *fname) { char *f; + int fn_max; /* open tmp file */ if (tmpdir) { @@ -179,7 +185,12 @@ rprintf(FERROR,"filename too long\n"); return 0; } - snprintf(fnametmp,MAXPATHLEN, "%s/.%s.XXXXXX",tmpdir,f); + fn_max = fname_syslimit(tmpdir); + if(strlen(f)+9...
2001 Nov 13
2
direct write patch
...file on that device is out of date. Rsync will first attempt to write a new temp file, and fail, SIGUSR1'ing itself, and outputting "Error 20". Specifically, I am writing a linux root fs to a 32Meg compact flash, and libc needs to be updated, and rsync fails. This patch simply sets fnametmp to fname. Two issues with the patch, that hopefully developers can answer: - In direct-write mode, I open without O_EXCL, as the file likely does exist. Should the destination file be deleted instead? (I do not know what exactly the race condition is) - There is a section after the assignment...
2011 Feb 24
1
osx 10.6 strange rsync errors
...like to ask the list if you think this is a likely to have any issues (eg filename comparisons relying on a dot always being added). On my system this change seems to work around the problem pretty well. Thanks Ira ( Look for "Modified Code" so see my change ) int get_tmpname(char *fnametmp, const char *fname) { int maxname, added, length = 0; const char *f; if (tmpdir) { /* Note: this can't overflow, so the return value is safe */ length = strlcpy(fnametmp, tmpdir, MAXPATHLEN - 2); fnametmp[length++] = '/'; } if ((f = strrchr(fname, '/')) != NULL) {...
2004 Apr 27
1
[PATCH] Inplace option for rsync
...fset += len; } flush_write_file(fd); + if (inplace) + ftruncate(fd, offset); + if (do_progress) end_progress(total_size); @@ -410,39 +424,52 @@ } else mapbuf = NULL; - if (!get_tmpname(fnametmp,fname)) { - if (mapbuf) unmap_file(mapbuf); - if (fd1 != -1) close(fd1); - continue; - } - - strlcpy(template, fnametmp, sizeof template); + /* We now check to see if we are writing file "inplace" */ +...
2004 Feb 17
1
[patch] Make robust_rename() handle EXDEV.
...= 0755; + } + do_copy = 1; + break; + + default: + return -1; + } + } + return -1; } patchwork diff rsync.c --- rsync.c 2004-02-17 09:58:48.000000000 -0500 +++ rsync.c 2004-02-17 10:13:31.000000000 -0500 @@ -236,21 +236,8 @@ /* move tmp file over real file */ if (robust_rename(fnametmp,fname) != 0) { - if (errno == EXDEV) { - /* rename failed on cross-filesystem link. - Copy the file instead. */ - if (copy_file(fnametmp,fname, file->mode & INITACCESSPERMS)) { - rprintf(FERROR, "copy %s -> \"%s\": %s\n", - full_fname(fnametmp), fname,...
2011 Apr 05
2
osx 10.6 strange rsync errors
...in the official list? Cheers Ira diff -Naur rsync-3.0.8_orig/receiver.c rsync-3.0.8_nodotdot/receiver.c --- rsync-3.0.8_orig/receiver.c 2011-04-05 17:12:03.000000000 +1000 +++ rsync-3.0.8_nodotdot/receiver.c 2011-04-05 17:20:40.000000000 +1000 @@ -103,7 +103,10 @@ } } else f = fname; - fnametmp[length++] = '.'; + + if ( f[0]!='.'){ + fnametmp[length++] = '.'; + } /* The maxname value is bufsize, and includes space for the '\0'. * NAME_MAX needs an extra -1 for the name's leading dot. */ > Hi Vernon, > > I don't know why I did...
2008 Oct 09
1
DO NOT REPLY [Bug 5820] New: rsync does not replace symlink atomically
...8-10-08 23:10:17.000000000 +0400 @@ -1556,9 +1556,40 @@ if (remove_source_files == 1) goto return_with_success; goto cleanup; + } else { + char fnametmp[MAXPATHLEN]; + + /* Replace the symlink atomically. */ + if (!get_tmpname(fnametmp, fname)) + goto cleanup; + if (!mktemp(fnametmp)) +...
2003 May 21
2
patch to avoid race condition in rsync 2.5.6
...rsync.c 2001-12-20 16:33:13.000000000 +0100 +++ src-2.5.6-local/rsync.c 2003-05-20 15:17:56.000000000 +0200 @@ -237,6 +237,9 @@ if (make_backups && !make_backup(fname)) return; + /* change permissions before putting the file in place */ + set_perms(fnametmp,file,NULL,0); + /* move tmp file over real file */ if (robust_rename(fnametmp,fname) != 0) { if (errno == EXDEV) { @@ -253,7 +256,5 @@ fnametmp,fname,strerror(errno)); } do_unlink(fnametmp); - } el...
2003 Jan 18
1
possible typo/bug in receiver.c
...ts to ensure that there is no race condition. They are then correctly updated after the lchown. Thanks to snabb@epipe.fi for pointing this out. We also set it initially without group access because of a similar race condition. */ fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS); if (fd2 == -1) { rprintf(FERROR,"mkstemp %s failed: %s\n",fnametmp,strerror(errno)); receive_data(f_in,buf,-1,NULL,file->length); if (buf) unmap_file(buf); if (fd1 != -1) clos...
2004 Feb 17
0
[patch] Add `--link-by-hash' option (rev 3).
...nk = iter->nlink; + best = iter; + } + iter = iter->next; + } while (iter != files); + + best->next->prev = best->prev; + best->prev->next = best->next; + if (files == best) + files = files->next; + kill_hashfiles(files); + return best; +} + + +int link_by_hash(char *fnametmp,char *fname,struct file_struct *file) +{ + STRUCT_STAT st; + char *hashname = make_hash_name(file); + int first = 0, rc; + char *linkname; + long last_fnbr; + + if (file->length == 0) { + return robust_rename(fnametmp,fname); + } + + if (do_stat(hashname, &st) == -1) { + char *dirname; +...
2004 Feb 23
0
[patch] Add `--link-by-hash' option (rev 5).
...nk = iter->nlink; + best = iter; + } + iter = iter->next; + } while (iter != files); + + best->next->prev = best->prev; + best->prev->next = best->next; + if (files == best) + files = files->next; + kill_hashfiles(files); + return best; +} + + +int link_by_hash(char *fnametmp,char *fname,struct file_struct *file) +{ + STRUCT_STAT st; + char *hashname = make_hash_name(file); + int first = 0, rc; + char *linkname; + long last_fnbr; + + if (file->length == 0) { + return robust_rename(fnametmp,fname,0644); + } + + if (do_stat(hashname, &st) == -1) { + char *dirna...
2004 Feb 23
0
[patch] Add `--link-by-hash' option (rev 4).
...nk = iter->nlink; + best = iter; + } + iter = iter->next; + } while (iter != files); + + best->next->prev = best->prev; + best->prev->next = best->next; + if (files == best) + files = files->next; + kill_hashfiles(files); + return best; +} + + +int link_by_hash(char *fnametmp,char *fname,struct file_struct *file) +{ + STRUCT_STAT st; + char *hashname = make_hash_name(file); + int first = 0, rc; + char *linkname; + long last_fnbr; + + if (file->length == 0) { + return robust_rename(fnametmp,fname,0644); + } + + if (do_stat(hashname, &st) == -1) { + char *dirna...
2004 Apr 11
1
fchmod in do_mkstemp? (patch included)
...ver.c --- receiver.c 23 Mar 2004 16:50:40 -0000 1.75 +++ receiver.c 10 Apr 2004 23:48:36 -0000 @@ -424,7 +424,7 @@ * the lchown. Thanks to snabb@epipe.fi for pointing * this out. We also set it initially without group * access because of a similar race condition. */ - fd2 = do_mkstemp(fnametmp, file->mode & INITACCESSPERMS); + fd2 = do_mkstemp(fnametmp); /* in most cases parent directories will already exist * because their information should have been previously @@ -432,7 +432,7 @@ if (fd2 == -1 && relative_paths && errno == ENOENT && c...
2005 Jul 26
1
[patch] paranoid checksum checking
...ther paranoia check, just to make sure that + we really have successfully transferred the file. */ + if (recv_ok && ! am_server && always_checksum) { + char csum[MD4_SUM_LENGTH + 1]; + file_checksum (fnametmp, csum, file->length); + if (memcmp(csum, file->u.sum, MD4_SUM_LENGTH) != 0) { + rprintf (FERROR, "%s checksum does not match remote checksum\n", + full_fname (fnametmp)); +...
2004 May 10
2
read error produces null-byte-filled destination file
I've run into a bug in the IO handling when reading a file. Suppose I have a file that lives on an NFS filesystem. That filesystem is NOT being exported with auth=0 permissions. So, if I try to access a file as root, it successfully opens the file, but subsequent reads fail with EACCES. This produces a destination file full of null bytes. I noticed this with 2.5.7, but checked 2.6.2 as
2002 Dec 05
1
Patch to ignore exluded files.
...rsync.c.orig Fri Jul 19 13:37:25 2002 > +++ rsync.c Fri Jul 19 13:36:42 2002 > @@ -236,13 +236,15 @@ > { > if (make_backups && !make_backup(fname)) > return; > + /* eric: set permisions before moving file */ > + set_perms(fnametmp, file, NULL, 0); > > /* move tmp file over real file */ > if (robust_rename(fnametmp,fname) != 0) { > if (errno == EXDEV) { > /* rename failed on cross-filesystem link. > Copy the file instead. */...
2002 Jul 24
0
couple of minor fixes to rsync 2.5.5
...fixed it with following diff: --- rsync.c.orig Fri Jul 19 13:37:25 2002 +++ rsync.c Fri Jul 19 13:36:42 2002 @@ -236,13 +236,15 @@ { if (make_backups && !make_backup(fname)) return; + /* eric: set permisions before moving file */ + set_perms(fnametmp, file, NULL, 0); /* move tmp file over real file */ if (robust_rename(fnametmp,fname) != 0) { if (errno == EXDEV) { /* rename failed on cross-filesystem link. Copy the file instead. */ - if (co...
2006 May 18
1
Partial files left on SIGINT
Hi, As the man page says, the --partial flag is to "keep partially transferred files". I'm assuming if I don't have partial flag any partially transferred files should be deleted. However this is not what I'm seeing. Example: (Using a big file so that rsync times a while to run. This gives me time to hit CTRL-C for the SIGINT). > mkdir example > dd if=/dev/zero
2003 Oct 06
2
Patch to revive tmpfiles
...eceiver.c 2003-10-06 14:30:35.000000000 +0200 @@ -457,13 +457,21 @@ if (fd1 != -1) { close(fd1); } - close(fd2); + + /* Revive temp file if someone removed it during receive */ + fd1 = do_open(fnametmp, O_RDONLY, 0); + if (fd1 == -1) { + sprintf(fnametmp, "/proc/self/fd/%d", fd2); + } else { + close(fd1); + } if (verbose > 2) rprintf(FINFO,"renaming %s t...
2003 Aug 26
1
Tired of "filename too long"? Me too...
...being maintained (to restart the download? I don't know, it seems like this would fail for files in tmpdir...). Anyway... --- rsync-2.5.6-orig/receiver.c Mon Jan 20 23:32:17 2003 +++ rsync-2.5.6/receiver.c Mon Aug 25 10:13:37 2003 @@ -163,33 +163,51 @@ } } - static int get_tmpname(char *fnametmp, char *fname) { - char *f; + char *f, holder; + size_t len; + + if(strlen(fname) > MAXPATHLEN) { + rprintf(FERROR,"%s: filename too long\n", fname); + return 0; + } + + holder = 0; /* open tmp file */ if (tmpdir) { + int tlen; f = strrchr(fname,'/'); if (f == NU...