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

Bug#607351: texlive-binaries: texdoc aliasing sometimes doesn't work



Hi Frank,

Le 06/06/2011 21:08, Frank Küster a écrit :
> tags 607351 fixed-upstream
> thanks
> 
> Manuel Pégourié-Gonnard <mpg@elzevir.fr> wrote:
> 
>> I went ahead and implemented that in texdoc 0.81, just uploaded to TeX Live. Now
>> texdoc finds its configuration files in $TEXMF/texdoc in the order prescribed by
>> the regular precedence between texmf trees.
>>
>> Which means the default configuration file should be installed in TEXMFDIST if
>> TEXMFMAIN happens to have higher precedence than TEXMFLOCAL (as in the case in
>> upstream TeX Live).
>>
>> I hope it fixes the problem.
> 
> yes, I think so.  I'm marking this as fixed upstream, however, we need
> to make sure when TL 2011 is packaged that it actually works with our
> configuration. Maybe we've already mis-patched the file locations.
> 
It just so happens, I got two reports in two days about the config file not
being found in Debian testing and current Ubuntu. I wonder if it would be
possible for you to fix this in a 2009-XX version of texlive-base without
waiting for TL 2011 packages to be ready.

I can see three options:

1. Install a symlink from /usr/share/texmf/texdoc/texdoc.cnf (where texdoc 0.61
expects the file) to /etc/texmf/texdoc/texdoc.cnf (its actual location).

2. Update texdoc to 0.81. This would require to update LUAINPUTS as mentioned in
my recent message to debian-tex-maint (which would anyway be a good idea imo).
Other than that, I just tested it and it works like a charm.

3. Alternatively, attached is a patch you can apply (with -p2 in
/usr/share/texmf-texlive/scripts/texdoc) to backport the feature from 0.81 to a
new 0.61a version. I tested it and found no problem with it.

Thanks,
Manuel.
diff --git a/script/config.tlu b/script/config.tlu
index dac13ef..4d12db1 100644
--- a/script/config.tlu
+++ b/script/config.tlu
@@ -281,21 +281,30 @@ function confline_to_config(line, file, pos)
     return false
 end
 
-
--- return a table with config file and if they exist
+-- return the list of configuration files
 function get_config_files ()
+    -- get names
     local platform = string.match (kpse.var_value ('SELFAUTOLOC'), '.*/(.*)$')
-    local TEXMFHOME  = kpse.var_value ('TEXMFHOME')
-    local TEXMFLOCAL = kpse.var_value ('TEXMFLOCAL')
-    local TEXMFMAIN  = kpse.var_value ('TEXMFMAIN')
-    return {
-        TEXMFHOME  .. '/texdoc/texdoc-'..platform..'.cnf',
-        TEXMFHOME  .. '/texdoc/texdoc.cnf',
-        TEXMFHOME  .. '/texdoc/texdoc-dist.cnf',
-        TEXMFLOCAL .. '/texdoc/texdoc-'..platform..'.cnf',
-        TEXMFLOCAL .. '/texdoc/texdoc.cnf',
-        TEXMFMAIN  .. '/texdoc/texdoc.cnf'
+    local names = {
+        'texdoc-'..platform..'.cnf',
+        'texdoc.cnf',
+        'texdoc-dist.cnf',
     }
+    -- get dirs
+    local sep = (os.type == 'windows') and ';' or ':'
+    local texmf_texdoc = kpse.expand_path('$TEXMF/texdoc')
+    local dirs = texmf_texdoc:explode(sep)
+    -- merge them
+    local ret = {}
+    for _, dir in ipairs(dirs) do
+        for _, name in ipairs(names) do
+            local pathname = dir .. '/' .. name
+            if lfs.isfile(pathname) then
+                table.insert(ret, pathname)
+            end
+        end
+    end
+    return ret
 end
 
 -- the config_files table is shared by the next two functions
@@ -304,31 +313,30 @@ local config_files = {}
 
 -- set config/aliases from all config files
 function setup_config_from_files ()
-    for i, file in ipairs (get_config_files ()) do
-        local found = lfs.isfile(file)
+    local file_list = get_config_files()
+    for i, file in ipairs (file_list) do
+        local status = config.lastfile_switch and 'disabled' or 'active'
         config_files[i] = {
             path = file,
-            status = found and (config.lastfile_switch
-            and 'disabled' or 'active') or 'absent',
+            status = status,
         }
-        if config_files[i].status == 'active' then
+        if status == 'active' then
             read_config_file (file)
         end
     end
 end
 
 -- now a special information function (see -f,--file option)
-function show_config_files (print_fun, prefix)
+function show_config_files (print_fun, verbose)
+    local pref = verbose and '    ' or ''
     print_fun("Configuration files are:")
     for i, file in ipairs (config_files) do
-        local home = prefix and
-        ((i==2) and "(*) " or "    ") -- home conffile is the 2nd
-        or ''
-        print_fun (home..file.status..'\t'..win32_hook(file.path))
+        print_fun(pref..file.status..'\t'..win32_hook(file.path))
     end
-    if prefix then
-        print("(*) This is the recommended configuration file "
-        .. "for your personal preferences.")
+    if verbose then
+        local texmfhome = kpse.var_value('TEXMFHOME')
+        print_fun('Recommended file for personal settings:')
+        print_fun(pref..texmfhome..'/texdoc/texdoc.cnf')
     end
 end
 
diff --git a/script/constants.tlu b/script/constants.tlu
index 2cbc995..649f4cf 100644
--- a/script/constants.tlu
+++ b/script/constants.tlu
@@ -15,7 +15,7 @@ load_env(L, {
 -- progname and version
 fullname    = arg[0]
 progname    = 'texdoc'
-version = '0.61'
+version = '0.61a'
 
 -- make sure to update setup_config_from_cl() accordingly
 -- and set a default value in setup_config_from_defaults() if relevant

Reply to: