Patch to ignore exluded files.
Bo Kersey
bo at vircio.com
Thu Dec 5 23:05:01 EST 2002
I came up with a patch to fix the problem of IO Errors caused by
excluded files as did Eugene V. Chupriyanov below.
Is there a chance that this change will show up in a future version of
rsync?
Is there a reason that we should not ignore IO errors when copy_links is
off? Just want to make sure that I'm not missing something here that
may corrupt my syncs....
Here's the version that I came up with before finding Eugene's patch:
--- rsync-2.5.5/flist.c.orig 2002-03-14 15:20:20.000000000 -0600
+++ rsync-2.5.5/flist.c 2002-12-02 19:27:02.000000000 -0600
@@ -644,8 +644,8 @@
if (readlink_stat(fname, &st, linkbuf) != 0) {
int save_errno = errno;
- if ((errno == ENOENT) && copy_links && !noexcludes) {
- /* symlink pointing nowhere, see if excluded */
+ if ((errno == ENOENT) && !noexcludes) {
+ /* File or directory not found, see if excluded */
memset((char *) &st, 0, sizeof(st));
if (check_exclude_file(f, fname, &st)) {
/* file is excluded anyway, ignore silently */
> Dear friends!
>
> I really appriciate the great job you did on rsync package and hope for its
> further improvement and development. It works great in our pretty complex
> environment and helps us a lot in our daily duties.
>
> But we've run into couple of small inconveniences.
>
> First one:
> We use rsyncd to propagate a tree of html files among several web-servers.
> That files are generated on the fly and updated every few minutes.
>
> Here is relevant part of rsyncd.conf:
> [sync-include]
> path=/usr/local/www/rbc/win/include
> exclude=*tmp
> use chroot=false
> max connections=2
> read only=true
> list=false
> uid=rbcmaint
> gid=www-all
>
> (Note the exlude line)
>
> Nevertheless I was getting errors like this:
>
> readlink .../include/cnews.html.tmp: No such file or directory
> rsync error: partial transfer (code 23) at main.c(578)
>
> I'm not sure I fixed it clean, but I get rid of that errors by patching
> flist.c. Here is the diff:
>
> --- flist.c.orig Mon Jul 8 17:48:12 2002
> +++ flist.c Mon Jul 8 17:48:39 2002
> @@ -644,7 +644,7 @@
>
> if (readlink_stat(fname, &st, linkbuf) != 0) {
> int save_errno = errno;
> - if ((errno == ENOENT) && copy_links && !noexcludes) {
> + if ((errno == ENOENT) && !noexcludes) {
> /* symlink pointing nowhere, see if excluded */
> memset((char *) &st, 0, sizeof(st));
> if (check_exclude_file(f, fname, &st)) {
>
> The second problem appears when we need that target files always have
> correct permissions - we do some testing on them and we receive errors, when
> file already copied and renamed from tempfile, but permission are not yet
> set. So I 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 (copy_file(fnametmp,fname, file->mode &
> INITACCESSPERMS)) {
> + if (copy_file(fnametmp,fname, file->mode)) {
> rprintf(FERROR,"copy %s -> %s : %s\n",
> fnametmp,fname,strerror(errno));
> } else {
>
> I hope these modifications don't break things apart. :)
> Thanks for your attention.
>
> ----
> Eugene V. Chupriyanov
> RosBusinessConsulting NOC
> mail to: eric at rbc.ru
>
>
> --
> To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html
--
Bo Kersey email: bo at vircio.com
VirCIO - managed network solutions phone: (512)374-0500
716 Congress Avenue, Suite 200
Austin, TX 78701
Repartee is something we think of twenty-four hours too late.
-- Sam Clemens
GPG Public Key: http://www.vircio.com/pubkeys/bo-gpg.txt
FingerPrint: 8DE7 90F2 E10C 80BA 6CBB 327E 3754 DA73 71F2 8A1C
Acrobat Public Key: http://www.vircio.com/pubkeys/bo-acrobat.fdf
MD5 FingerPrint: 534D AEF7 69DF 48FC AE5E 45F8 AFC8 3DAB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/rsync/attachments/20021205/0d6436c7/attachment.bin
More information about the rsync
mailing list