]> granicus.if.org Git - neomutt/commitdiff
Remove compare_stat() call in safe_rename()
authorKevin McCarthy <kevin@8t8.us>
Tue, 14 Aug 2018 21:31:34 +0000 (14:31 -0700)
committerRichard Russon <rich@flatcap.org>
Sat, 1 Sep 2018 17:06:08 +0000 (18:06 +0100)
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.

mutt/file.c

index 34bc013952ebed05d6b1b6ded01a06f0d75845a9..91da3e1a7d088d0c92605fa206c702366c305be4 100644 (file)
@@ -396,12 +396,21 @@ int mutt_file_safe_rename(const char *src, const char *target)
 
   /* pretend that the link failed because the target file 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))
   {
     mutt_debug(1, "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 value here? XXX */