[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Texinfo Windows patch: Avoid duplicate Info directories
From: |
Eli Zaretskii |
Subject: |
Re: Texinfo Windows patch: Avoid duplicate Info directories |
Date: |
Thu, 25 Dec 2014 17:55:25 +0200 |
> Date: Fri, 07 Nov 2014 17:55:36 +1000
> From: Jason Hood <address@hidden>
>
> * enhances the gnulib stat replacement to provide meaningful values for
> st_ino & st_dev, thus enabling detection of duplicate directories;
This was reported by Jason to Gnulib, but I see no responses to that
message
(http://lists.gnu.org/archive/html/bug-gnulib/2014-11/msg00025.html)
till this day. Meanwhile, I propose the patch below, which achieves
the same effect by using file-name comparison. I think we should use
the below regardless of whether the Gnulib folks get their act
together or not.
OK to commit?
--- info/info-utils.c~0 2014-12-23 21:51:58 +0200
+++ info/info-utils.c 2014-12-24 16:22:30 +0200
@@ -2021,7 +2030,7 @@ text_buffer_printf (struct text_buffer *
#if defined(__MSDOS__) || defined(__MINGW32__)
/* Cannot use FILENAME_CMP here, since that does not consider forward-
and back-slash characters equal. */
-static int
+int
fncmp (const char *fn1, const char *fn2)
{
const char *s1 = fn1, *s2 = fn2;
@@ -2037,8 +2046,6 @@ fncmp (const char *fn1, const char *fn2)
return tolower (*s1) - tolower (*s2);
}
-#else
-# define fncmp(s,t) strcmp(s,t)
#endif
struct info_namelist_entry
--- info/info-utils.h~0 2014-12-24 09:43:41 +0200
+++ info/info-utils.h 2014-12-24 14:21:16 +0200
@@ -142,4 +142,10 @@
int info_namelist_add (struct info_namelist_entry **ptop, const char *name);
void info_namelist_free (struct info_namelist_entry *top);
+#if defined(__MSDOS__) || defined(__MINGW32__)
+int fncmp (const char *fn1, const char *fn2);
+#else
+# define fncmp(s,t) strcmp(s,t)
+#endif
+
#endif /* not INFO_UTILS_H */
--- info/infopath.c~0 2014-12-23 21:51:59 +0200
+++ info/infopath.c 2014-12-24 14:25:35 +0200
@@ -173,8 +173,8 @@ infopath_add_dir (char *path)
if ( dirinfo.st_ino == infodirs[i]->inode
&& dirinfo.st_dev == infodirs[i]->device
/* On MS-Windows, `stat' returns zero as the inode, so we
- effectively disable this optimization for that OS. */
- && infodirs[i]->inode != 0)
+ use file-name comparison instead for that OS. */
+ && (infodirs[i]->inode != 0 || fncmp (path, infodirs[i]->name) == 0))
{
debug (2, ("duplicate directory %s not added to INFOPATH", path));
free (path);
- Re: Texinfo Windows patch: Avoid duplicate Info directories,
Eli Zaretskii <=