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

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



On 2022-03-16 17:46:28 +0900, Jun T wrote:
> 'info -f' accept any (relative or absolute) pathnames.

Well, not exactly. It seems that the rule for "info -f" is that
if the argument does not have a slash, then the usual info path
is used (with no fallback if nothing is found, i.e. an existing
pathname in the current directory will be ignored), otherwise
the argument is regarded as a pathname. However, a set of
suffixes are tried:

zira% strace info -f /blah |& grep /blah     
execve("/usr/bin/info", ["info", "-f", "/blah"], 0x7ffe463ed830 /* 135 vars */) = 0
newfstatat(AT_FDCWD, "/blah.info", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.gz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.lz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.xz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.bz2", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.lzma", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.Z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.info.Y", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.gz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.lz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.xz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.bz2", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.lzma", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.Z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah-info.Y", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.gz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.lz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.xz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.bz2", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.lzma", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.Z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah/index.Y", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.gz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.lz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.xz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.bz2", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.lzma", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.Z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.inf.Y", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.gz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.lz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.xz", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.bz2", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.lzma", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.Z", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/blah.Y", 0x7ffe9d145a20, 0) = -1 ENOENT (No such file or directory)
write(2, "/blah: No such file or directory", 32/blah: No such file or directory) = 32

Note: The ".inf" ones are probably for the MS-DOS filenames. They are
probably never seen under Unix, at least nowadays.

So, if there is a file /path/to/foo.info (possibly with an extension
corresponding to compression), then the completion should work as
follows:

  /path/to/f[Tab]

gives

  /path/to/foo

and

  /path/to/foo.[Tab]

gives

  /path/to/foo.info

(info supports both /path/to/foo and /path/to/foo.info, the former
form being preferred).

-- 
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