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

[texinfo] 01/01: allow subdirs for info files



This is an automated email from the git hooks/post-receive script.

preining pushed a commit to branch master
in repository texinfo.

commit 7afc2909c7ec168fe5902cae32df246cac626f3b
Author: Norbert Preining <preining@debian.org>
Date:   Thu Jul 16 08:29:58 2015 +0900

    allow subdirs for info files
---
 debian/changelog                  |   7 ++
 debian/patches/series             |   1 +
 debian/patches/slash-in-dir-entry | 167 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 175 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 5a9f1e3..8683e38 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+texinfo (6.0.0.dfsg.1-4~1) UNRELEASED; urgency=medium
+
+  * including a patch to allow for info files in subdir (Closes: #792328)
+    STILL IN TESTING
+
+ -- Norbert Preining <preining@debian.org>  Thu, 16 Jul 2015 08:29:19 +0900
+
 texinfo (6.0.0.dfsg.1-3) unstable; urgency=medium
 
   * ignore jpg files in update-info-dir (Closes: #790519)
diff --git a/debian/patches/series b/debian/patches/series
index 1181ebc..ec86962 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ info-manpage-mentiones-nonfree
 do-not-require-automake-1.15
 upstream-svn6390-index-deterministic
 #texinfo-make-index-deterministic
+slash-in-dir-entry
diff --git a/debian/patches/slash-in-dir-entry b/debian/patches/slash-in-dir-entry
new file mode 100644
index 0000000..3f1ebd4
--- /dev/null
+++ b/debian/patches/slash-in-dir-entry
@@ -0,0 +1,167 @@
+allow for info files and dir entries with subdirs
+patch by Gavin Smith on the bug-texinfo and debbug 792328
+---
+ ChangeLog      |   16 ++++++++++++++++
+ info/filesys.c |   31 +++++++++++++++++++++----------
+ info/info.c    |   29 ++++++++++++++++++++++++-----
+ info/nodes.c   |    3 ++-
+ 4 files changed, 63 insertions(+), 16 deletions(-)
+
+--- texinfo.orig/ChangeLog
++++ texinfo/ChangeLog
+@@ -1,3 +1,19 @@
++2015-07-15  Gavin Smith  <gavinsmith0123@gmail.com>
++
++	* info/nodes.c (info_find_file): If filename has slash, look for
++	it in search path if it does not begin "./".
++	* info/filesys.c (info_find_fullpath): Don't look for a filename 
++	beginning "./" in the search path, but otherwise look for the 
++	filename in the search path even if it contains a slash.
++	(info_file_find_next_in_path): Prefix returned path with "./" if 
++	it is relative to the current directory.
++	(info_add_extension): Allow second argument to be null.
++
++	* info/info.c (main) <--file or slash in argument>: If argument 
++	not an absolute path, prefix it with "./".  Call 
++	info_add_extension instead of info_find_fullpath for arguments 
++	other than simple filenames.
++
+ 2015-07-05  Patrice Dumas  <pertusus@free.fr>
+ 
+ 	* tp/Texinfo/Structuring.pm (_sort_index_entries,
+--- texinfo.orig/info/filesys.c
++++ texinfo/info/filesys.c
+@@ -77,8 +77,7 @@
+   { NULL, NULL }
+ };
+ 
+-/* Expand the filename in PARTIAL to make a real name for this operating
+-   system.  This looks in INFOPATH in order to find the correct file.
++/* Look for the filename PARTIAL in INFOPATH in order to find the correct file.
+    Return file name and set *FINFO with information about file.  If it
+    can't find the file, it returns NULL, and sets filesys_error_number.
+    Return value should be freed by caller. */
+@@ -101,7 +100,8 @@
+   /* IS_SLASH and IS_ABSOLUTE defined in ../system.h. */
+ 
+   /* If path is absolute already, see if it needs an extension. */
+-  if (IS_ABSOLUTE (partial))
++  if (IS_ABSOLUTE (partial)
++      || partial[0] == '.' && IS_SLASH(partial[1]))
+     {
+       fullpath = info_add_extension (0, partial, finfo);
+     }
+@@ -113,12 +113,6 @@
+       fullpath = info_add_extension (0, partial, finfo);
+     }
+ 
+-  /* If filename has a slash in it (for example, begins with "./" or "../", or
+-     if there are intermediate directories) interpret it as relative to current
+-     directory.  This may be from the command line, or in the subfiles table of
+-     a split file. */
+-  else if (HAS_SLASH (partial))
+-    fullpath = info_add_extension (0, partial, finfo);
+   /* If just a simple name element, look for it in the path. */
+   else
+     fullpath = info_file_in_path (partial, finfo);
+@@ -168,11 +162,24 @@
+       with_extension = info_add_extension (dirname, filename, finfo);
+ 
+       if (with_extension)
+-        return with_extension;
++        {
++          if (!IS_ABSOLUTE (with_extension))
++            {
++              /* Prefix "./" to it. */
++              char *s;
++              asprintf (&s, "%s%s", "./", with_extension);
++              free (with_extension);
++              return s;
++            }
++          else
++            return with_extension;
++        }
+     }
+   return NULL;
+ }
+ 
++/* Return full path of first Info file known as FILENAME in
++   search path.  If relative to current directory, precede it with './'. */
+ static char *
+ info_file_in_path (char *filename, struct stat *finfo)
+ {
+@@ -189,6 +196,10 @@
+ {
+   char *try_filename;
+   register int i, pre_suffix_length = 0;
++  struct stat dummy;
++
++  if (!finfo)
++    finfo = &dummy;
+ 
+   if (dirname)
+     pre_suffix_length += strlen (dirname);
+--- texinfo.orig/info/info.c
++++ texinfo/info/info.c
+@@ -825,7 +825,7 @@
+      for a matching entry. */
+   if (!user_filename && argv[0] && HAS_SLASH (argv[0]))
+     {
+-      user_filename = argv[0];
++      user_filename = xstrdup (argv[0]);
+       argv++; /* Advance past first remaining argument. */
+       argc--;
+     }
+@@ -873,7 +873,7 @@
+       /* --all */
+       if (!user_filename && argv[0])
+         {
+-          user_filename = argv[0];
++          user_filename = xstrdup (argv[0]);
+           argv++; argc--;
+         }
+       else if (!user_filename)
+@@ -904,9 +904,28 @@
+       /* User used "--file". */
+       if (user_filename)
+         {
+-          initial_file = info_find_fullpath (user_filename, 0);
+-          if (!initial_file && filesys_error_number)
+-            error = filesys_error_string (user_filename, filesys_error_number);
++          if (!IS_ABSOLUTE(user_filename) && HAS_SLASH(user_filename)
++              && !(user_filename[0] == '.' && IS_SLASH(user_filename[1])))
++            {
++              /* Prefix "./" to the filename to prevent a lookup
++                 in INFOPATH.  */
++              char *s;
++              asprintf (&s, "%s%s", "./", user_filename);
++              free (user_filename);
++              user_filename = s;
++            }
++          if (IS_ABSOLUTE(user_filename) || HAS_SLASH(user_filename))
++            initial_file = info_add_extension (0, user_filename, 0);
++          else
++            initial_file = info_find_fullpath (user_filename, 0);
++
++          if (!initial_file)
++            {
++              if (!filesys_error_number)
++                filesys_error_number = ENOENT;
++              error = filesys_error_string (user_filename, 
++                                            filesys_error_number);
++            }
+           else
+             add_pointer_to_array (info_new_reference (initial_file, "Top"),
+                                   ref_index, ref_list, ref_slots, 2);
+--- texinfo.orig/info/nodes.c
++++ texinfo/info/nodes.c
+@@ -559,7 +559,8 @@
+   int is_fullpath;
+   
+   /* If full path to the file has been given, we must find it exactly. */
+-  is_fullpath = IS_ABSOLUTE (filename) || HAS_SLASH (filename);
++  is_fullpath = IS_ABSOLUTE (filename)
++                || filename[0] == '.' && IS_SLASH(filename[1]);
+ 
+   /* First try to find the file in our list of already loaded files. */
+   if (info_loaded_files)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-tex/texinfo.git


Reply to: