<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Rob / Wayne,</div><div><br></div><div>Sorry for the slow reply Rob.</div><div><br></div><div>I'm not sure of the requirements for patches, but I think it would be useful to create one for this case as there are reasonably number of people affected.</div><div><br></div><div>I created a patch file against the current version (see below). </div><div><br></div><div>Would it be possible to include this patch in the official list? </div><div><br></div><div>Cheers</div><div>Ira</div><div><br></div><div><br></div><div><br></div><div><div>diff -Naur rsync-3.0.8_orig/receiver.c rsync-3.0.8_nodotdot/receiver.c</div><div>--- rsync-3.0.8_orig/receiver.c<span class="Apple-tab-span" style="white-space:pre">       </span>2011-04-05 17:12:03.000000000 +1000</div><div>+++ rsync-3.0.8_nodotdot/receiver.c<span class="Apple-tab-span" style="white-space:pre">       </span>2011-04-05 17:20:40.000000000 +1000</div><div>@@ -103,7 +103,10 @@</div><div> <span class="Apple-tab-span" style="white-space:pre">         </span>}</div><div> <span class="Apple-tab-span" style="white-space:pre">      </span>} else</div><div> <span class="Apple-tab-span" style="white-space:pre">         </span>f = fname;</div><div>-<span class="Apple-tab-span" style="white-space:pre">  </span>fnametmp[length++] = '.';</div><div>+<span class="Apple-tab-span" style="white-space:pre">           </span></div><div>+<span class="Apple-tab-span" style="white-space:pre">    </span>if ( f[0]!='.'){</div><div>+<span class="Apple-tab-span" style="white-space:pre">            </span>fnametmp[length++] = '.';</div><div>+<span class="Apple-tab-span" style="white-space:pre">   </span>}</div><div> </div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>/* The maxname value is bufsize, and includes space for the '\0'.</div><div> <span class="Apple-tab-span" style="white-space:pre">      </span> * NAME_MAX needs an extra -1 for the name's leading dot. */</div></div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite">Hi Vernon,<br><br>I don't know why I didn't think of that - I was telling people to exclude all . files! Thanks. I wonder if this is foolproof enough to create a patch since it seems to be an ongoing bug with OS releases.<br><br>Best,  Rob<br><br>On Feb 24, 2011, at 4:54 AM, Ira Cooke wrote:<br><br><blockquote type="cite">I've recently encountered this issue which was discussed here about a year ago. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm not sure if anyone has a fix for this, but I thought I would post my workaround here. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Since the topic is old, I'm summarising the problem .. basically it involves rsync creating large numbers of files with a leading ".." when syncing to an apple network share via afp. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">The essence of the problem is that there is an apple bug which causes weird phantom files to be created whenever an attempt is made to create a file with a leading ".."<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">As a workaround I figured the simplest thing to do would be to ensure that rsync only ever adds a "." when creating tmp files for filenames that do not already have a leading dot. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I've attached a modified version of the get_tmpname method which simply wraps the addition of a "." in an if statement. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'd 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). <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On my system this change seems to work around the problem pretty well. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks<br></blockquote><blockquote type="cite">Ira<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">( Look for "Modified Code" so see my change )<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">int get_tmpname(char *fnametmp, const char *fname)<br></blockquote><blockquote type="cite">{<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; "> </span>int maxname, added, length = 0;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">     </span>const char *f;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; "> </span>if (tmpdir) {<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">       </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* Note: this can't overflow, so the return value is safe */<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; "> </span>length = strlcpy(fnametmp, tmpdir, MAXPATHLEN - 2);<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>fnametmp[length++] = '/';<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">   </span>}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">      </span>if ((f = strrchr(fname, '/')) != NULL) {<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">    </span><span class="Apple-tab-span" style="white-space: pre; "> </span>++f;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; "> </span>if (!tmpdir) {<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">      </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>length = f - fname;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>/* copy up to and including the slash */<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">    </span><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>strlcpy(fnametmp, fname, length + 1);<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">       </span><span class="Apple-tab-span" style="white-space: pre; "> </span>}<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">   </span>} else<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">      </span><span class="Apple-tab-span" style="white-space: pre; "> </span>f = fname;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">  </span><span class="Apple-tab-span" style="white-space: pre; "> </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">    </span>// Modified Code <span class="Apple-tab-span" style="white-space: pre; ">   </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">    </span>if ( f[0]!='.'){ <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">      </span><span class="Apple-tab-span" style="white-space: pre; "> </span>fnametmp[length++] = '.';<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">   </span>} <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">     </span>// End Modified Code <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">  </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">    </span>/* The maxname value is bufsize, and includes space for the '\0'.<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">   </span> * (Note that NAME_MAX get -8 for the leading '.' above.) */<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">   </span>maxname = MIN(MAXPATHLEN - 7 - length, NAME_MAX - 8);<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">  </span>if (maxname < 1) {<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">       </span><span class="Apple-tab-span" style="white-space: pre; "> </span>rprintf(FERROR_XFER, "temporary filename too long: %s\n", fname);<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>fnametmp[0] = '\0';<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; "> </span><span class="Apple-tab-span" style="white-space: pre; "> </span>return 0;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">   </span>}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">      </span>added = strlcpy(fnametmp + length, f, maxname);<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">     </span>if (added >= maxname)<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">    </span><span class="Apple-tab-span" style="white-space: pre; "> </span>added = maxname - 1;<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">        </span>memcpy(fnametmp + length + added, ".XXXXXX", 8);<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space: pre; ">     </span>return 1;<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite">-- <br></blockquote><blockquote type="cite">Please use reply-all for most replies to avoid omitting the mailing list.<br></blockquote><blockquote type="cite">To unsubscribe or change options: <a href="https://lists.samba.org/mailman/listinfo/rsync">https://lists.samba.org/mailman/listinfo/rsync</a><br></blockquote><blockquote type="cite">Before posting, read: <a href="http://www.catb.org/~esr/faqs/smart-questions.html">http://www.catb.org/~esr/faqs/smart-questions.html</a></blockquote></blockquote></body></html>