zsh-workers
 help / color / mirror / code / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: completion for "info -f" does not work
Date: Fri, 18 Mar 2022 14:59:53 +0100	[thread overview]
Message-ID: <20220318135953.GA35304@zira.vinc17.org> (raw)
In-Reply-To: <2C495A59-EBA8-4C23-B0BB-964C4F0FEA40@kba.biglobe.ne.jp>

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@vinc17.net> - 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)


  parent reply	other threads:[~2022-03-18 14:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15 17:13 Vincent Lefevre
2022-03-15 18:05 ` Peter Stephenson
2022-03-16  8:46   ` Jun T
2022-03-16 15:06     ` Peter Stephenson
2022-03-16 15:13       ` Bart Schaefer
2022-03-16 15:28       ` Jun. T
2022-03-17 16:29         ` Peter Stephenson
2022-03-18 13:59     ` Vincent Lefevre [this message]
2022-03-18 14:09       ` Vincent Lefevre
2022-03-22  9:46         ` Jun T
2022-03-22 13:32           ` Vincent Lefevre
2022-03-22  9:35       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220318135953.GA35304@zira.vinc17.org \
    --to=vincent@vinc17.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).