]> granicus.if.org Git - mutt/commitdiff
Remove compare_stat() call in safe_rename().
authorKevin McCarthy <kevin@8t8.us>
Tue, 14 Aug 2018 21:31:34 +0000 (14:31 -0700)
committerKevin McCarthy <kevin@8t8.us>
Tue, 21 Aug 2018 22:27:26 +0000 (15:27 -0700)
Some filesystems, such as sshfs, implement hard links strangely.  The
hard link is created, but is represented by a different inode number
by the sshfs layer.  The current maildir code goes into an infinite
loop in this case.  Remove the compare_stat() and trust that a link()
return code of 0 means the link really did get created.  Still, keep
the stats just as a minor check.

lib.c

diff --git a/lib.c b/lib.c
index 6f7113e1a0c5471721a37e946db5ae571562ef02..9a5d532598ec5a9be0c73f36c94b9c82cad899ec 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -517,12 +517,21 @@ int safe_rename (const char *src, const char *target)
    * did already exist.
    */
 
+#if 0
+  /*
+   * Remove this check, because it causes problems with maildir on
+   * filesystems that don't properly support hard links, such as
+   * sshfs.  The filesystem creates the link, but the resulting file
+   * is given a different inode number by the sshfs layer.  This
+   * results in an infinite loop creating links.
+   */
   if (compare_stat (&ssb, &tsb) == -1)
   {
     dprint (1, (debugfile, "safe_rename: stat blocks for %s and %s diverge; pretending EEXIST.\n", src, target));
     errno = EEXIST;
     return -1;
   }
+#endif
 
   /*
    * Unlink the original link.  Should we really ignore the return