I remember that I put in that code, not so long ago, because I was getting
errors with symlinks pointing nowhere even though they were excluded.
It is revisions 1.96 and 1.95 at
http://cvs.samba.org/cgi-bin/cvsweb/rsync/flist.c
As far as I could see, the only time that the ENOENT error could occur
is if copy_links is on; readlink_stat() won't try to follow the symlink
otherwise. Ah, I see there might also be a case when copy_unsafe_links is
on; are you using --copy-unsafe-links? If not, can you please completely
specify a small set of steps, beginning from an empty directory, that
someone could do to demonstrate the problem for which you believe the
below patch will help?
Oh, I see the original poster was talking about files being dynamically
created and deleted during an rsync run; that was something I had not
thought of. In general, rsync does not even try to support such situations
because they are so difficult to handle robustly. However, I suppose
it makes sense to ignore files that are excluded. My first thought
was that it might impact performance for the normal case, but really it
won't because the excludes are only checked when a ENOENT failure occurs.
I'll go ahead and take out the check for copy_links.
- Dave Dykstra
On Thu, Dec 05, 2002 at 05:04:38PM -0600, Bo Kersey
wrote:> 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@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@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