Skip to content

texdoclib-view.tlu:24: attempt to index a nil value (local 'docfile') #130

@muzimuzhi

Description

@muzimuzhi

Reproduction steps:

  1. Run texdoc <unknown-name>
  2. Answer 1 to the prompt Would you like to search online? (y/N)
$ texdoc blahblah
Unfortunately, there are no good matches for "blahblah".

There may be online documentation available for "blahblah" at
    https://texdoc.org/serve/blahblah/0
This documentation may be for a different version than you have installed.

Would you like to search online? (y/N) 1
...e/2025basic/texmf-dist/scripts/texdoc/texdoclib-view.tlu:24: attempt to index a nil value (local 'docfile')

Google told me that Andreas Eder encountered the same Lua error in May 2024, but it seems that didn't get reported to texdoc. Also noted the steps to trigger the error changed. http://ftp.tug.org/pipermail/tex-live/2024-May/050587.html

-- view a document
-- see texdoclib-search.tlu for the structure of the argument
local function view_doc(docfile)
M.view_file(docfile.realpath)
end

if docs_installed and doclist[1] then
write(C.badmatch_prompt)
else
write(C.nolocaldocs_prompt)
end
local ans = io.read('*line')
if ans:match('^\r?[yY]') then
M.view_file(url)
elseif tonumber(ans) then
view_doc(doclist[tonumber(ans)])
end

C.badmatch_prompt and C.nolocaldocs_prompt share the same logic to process ans, but only the former accepts numbers, the latter only accepts [yYnN] (or, treat anything other than [yY] as false).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions