Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion for "info -f" does not work



On 2022-03-22 18:46:13 +0900, Jun T wrote:
> > zira% touch for-test-only.info
> > zira% info -f for-test-only
> > info: for-test-only: No such file or directory
> 
> I can't reproduce this. Which version of info are you using?

info (GNU texinfo) 6.8

from the info 6.8-4+b1 Debian package (Debian/unstable).

But I've just found that this is due to my INFOPATH environment
variable, which is set to "$HOME/share/info". See below.

> info command has an (undocumented) option -x for setting the
> debug level.
> 
> % info -x 1 -f for-test-only    # use -x 2 for more verbose output
> info: looking for file "for-test-only"
> info: looking for file for-test-only in /usr/share/info
> info: looking for file for-test-only in /home/takimoto/.local/share/info
> info: looking for file for-test-only in .
> info: found file ./for-test-only.info

cventin% info -x 1 -f for-test-only
info: looking for file "for-test-only"
info: looking for file for-test-only in /home/vlefevre/share/info
info: looking for file for-test-only in /usr/share/info
info: for-test-only: No such file or directory

cventin% unset INFOPATH
cventin% info -x 1 -f for-test-only
info: looking for file "for-test-only"
info: looking for file for-test-only in /usr/share/info
info: looking for file for-test-only in /home/vlefevre/share/info
info: looking for file for-test-only in .
info: found file ./for-test-only.info

This actually behaves as documented:

     Directories specified in the environment variable 'INFOPATH' are
     added to the directories specified with '--directory', if any.  The
     value of 'INFOPATH' is a list of directories usually separated by a
     colon; on MS-DOS/MS-Windows systems, the semicolon is used.  If the
     value of 'INFOPATH' ends with a colon (or semicolon on
     MS-DOS/MS-Windows), the initial list of directories is constructed
     by appending the build-time default to the value of 'INFOPATH'.

     If you do not define 'INFOPATH', Info uses a default path defined
     when Info was built as the initial list of directories.

     Regardless of whether 'INFOPATH' is defined, the default
     documentation directory defined when Info was built is added to the
     search path.  If you do not want this directory to be included, set
     the 'infopath-no-defaults' variable to 'On' (*note
     infopath-no-defaults::).

(BTW, I'm wondering whether there could be a security issue with "."
in the default info path.)

> PS
> I've surprised that 'info for-test-only' (without -f) also gives the
> same result. So I wonder what is the difference between 'info foo ...'
> and 'info -f foo ...' ?

It seems that without "-f", info first looks for menu items and
converts the argument to a filename prefix as with -f:

Example:

cventin% info -x 1 -f ls
info: looking for file "ls"
info: looking for file ls in /home/vlefevre/share/info
info: looking for file ls in /usr/share/info
info: ls: No such file or directory

cventin% info -x 1 ls
info: found file /home/vlefevre/share/info/dir
info: found file /usr/share/info/dir
info: looking for file "coreutils"
info: looking for file coreutils in /home/vlefevre/share/info
info: looking for file coreutils in /usr/share/info
info: found file /usr/share/info/coreutils.info.gz

Here, the error message is different:

cventin% info -x 1 -f does-not-exist
info: looking for file "does-not-exist"
info: looking for file does-not-exist in /home/vlefevre/share/info
info: looking for file does-not-exist in /usr/share/info
info: does-not-exist: No such file or directory

cventin% info -x 1 does-not-exist
info: found file /home/vlefevre/share/info/dir
info: found file /usr/share/info/dir
info: looking for file "does-not-exist"
info: looking for file does-not-exist in /home/vlefevre/share/info
info: looking for file does-not-exist in /usr/share/info
info: No menu item 'does-not-exist' in node '(dir)Top'

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author