texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7915] info_find_subfile


From: gavinsmith0123
Subject: [7915] info_find_subfile
Date: Sun, 9 Jul 2017 14:51:00 -0400 (EDT)

Revision: 7915
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7915
Author:   gavin
Date:     2017-07-09 14:51:00 -0400 (Sun, 09 Jul 2017)
Log Message:
-----------
info_find_subfile

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/nodes.c

Added Paths:
-----------
    trunk/info/t/infodir/subfile-initial-match-1
    trunk/info/t/infodir/subfile-initial-match-10
    trunk/info/t/infodir/subfile-initial-match.info

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-07-09 17:57:39 UTC (rev 7914)
+++ trunk/ChangeLog     2017-07-09 18:51:00 UTC (rev 7915)
@@ -1,5 +1,18 @@
 2017-07-09  Gavin Smith  <address@hidden>
 
+       * info/nodes.c (info_find_subfile): When looking for an 
+       already-loaded file, check that the names match either exactly, 
+       or as an initial substring followed by a period.  Previously,
+       any loaded file which had an initial substring that was the name 
+       of the sought file would be accepted, which would be incorrect
+       for a case like "libc.info-11" matching when it was "libc.info-1"
+       that was wanted.  Vitezslav Crhonek reported that this could 
+       lead to failure when following cross-references.
+
+       * info/t/subfile-initial-match.sh: New test.
+
+2017-07-09  Gavin Smith  <address@hidden>
+
        * info/nodes.c (info_get_node_with_defaults): Only use the
        directory from the current node's fullpath if this function was 
        passed a filename as an argument.

Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c  2017-07-09 17:57:39 UTC (rev 7914)
+++ trunk/info/nodes.c  2017-07-09 18:51:00 UTC (rev 7915)
@@ -650,6 +650,7 @@
   char *with_extension = 0;
   int i;
   FILE_BUFFER *file_buffer = 0;
+  int fullpath_len = strlen (fullpath);
 
   /* First try to find the file in our list of already loaded files. */
   if (info_loaded_files)
@@ -657,7 +658,9 @@
       for (i = 0; (file_buffer = info_loaded_files[i]); i++)
         /* Check if fullpath starts the name of the recorded file (extra
            extensions like ".info.gz" could be added.) */
-        if (!strncmp (file_buffer->fullpath, fullpath, strlen (fullpath)))
+        if (!strncmp (file_buffer->fullpath, fullpath, fullpath_len)
+            && (file_buffer->fullpath[fullpath_len] == '\0'
+                || file_buffer->fullpath[fullpath_len] == '.'))
           {
             struct stat new_info, *old_info;
 

Added: trunk/info/t/infodir/subfile-initial-match-1
===================================================================
(Binary files differ)

Index: trunk/info/t/infodir/subfile-initial-match-1
===================================================================
--- trunk/info/t/infodir/subfile-initial-match-1        2017-07-09 17:57:39 UTC 
(rev 7914)
+++ trunk/info/t/infodir/subfile-initial-match-1        2017-07-09 18:51:00 UTC 
(rev 7915)

Property changes on: trunk/info/t/infodir/subfile-initial-match-1
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/info/t/infodir/subfile-initial-match-10
===================================================================
(Binary files differ)

Index: trunk/info/t/infodir/subfile-initial-match-10
===================================================================
--- trunk/info/t/infodir/subfile-initial-match-10       2017-07-09 17:57:39 UTC 
(rev 7914)
+++ trunk/info/t/infodir/subfile-initial-match-10       2017-07-09 18:51:00 UTC 
(rev 7915)

Property changes on: trunk/info/t/infodir/subfile-initial-match-10
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/info/t/infodir/subfile-initial-match.info
===================================================================
(Binary files differ)

Index: trunk/info/t/infodir/subfile-initial-match.info
===================================================================
--- trunk/info/t/infodir/subfile-initial-match.info     2017-07-09 17:57:39 UTC 
(rev 7914)
+++ trunk/info/t/infodir/subfile-initial-match.info     2017-07-09 18:51:00 UTC 
(rev 7915)

Property changes on: trunk/info/t/infodir/subfile-initial-match.info
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property



reply via email to

[Prev in Thread] Current Thread [Next in Thread]