Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: man_pages on macOS 13 and FreeBSD #2326 #2352

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

fschauen
Copy link
Contributor

Description

In macOS 13 (Ventura), :Telescope man_pages shows no results. This is caused by a difference in behavior between the previous implementation of apropos(1) up to macOS 12.5 and the new man package used in macOS 13, which comes from FreeBSD.

This new apropos(1) is implemented as a shell script and loses the " " argument through variable expansions. Since apropos(1) expects a regular expression to filter the results of the whatis database, passing "." causes it to not lose the argument and match everything, thus returning all results so they can be filtered within Telescope.

In the process of investigating the root cause for the issue on macOS 13, I realized that :Telescope man_pages doesn't work in FreeBSD for the same reason. Therefore, I included it in the fix.

Fixes #2326

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Test steps:

  1. Start nvim (on either macOS 13 or FreeBSD).
  2. Open man_pages picker with :Telescope man_pages.
    • Result: list is populated with available man pages.

Configuration:

  • Neovim version (nvim --version):
NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Ventura

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.8.2/share/nvim"
  • Operating system and version:
    • macOS 13.0.1
    • FreeBSD 13.1-RELEASE (virtual machine)

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas - not applicable
  • I have made corresponding changes to the documentation (lua annotations) - not applicable

macOS 13.x (Ventura, Darwin 22.x) uses `apropos(1)` from FreeBSD, which
does not behave the same as the previous implementation up to macOS 12.

`apropos(1)` takes a regular expression as an argument, so passing "."
causes it to match anything and therefore return all results to be
filtered by Telescope.
@fschauen fschauen marked this pull request as ready for review January 29, 2023 21:37
Copy link
Member

@kkharji kkharji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While testing, I came to found out that I haven't been using builtin man on macos at all :D (man-db + nix).

Everything works fine. But somehow I got back 4 extra entries with this fix, don't ask me what are they, haven't bothered 😆

Thanks @fschauen

@Conni2461
Copy link
Member

Thanks for debugging and fixing this issue :)

@Conni2461 Conni2461 merged commit d5f6c09 into nvim-telescope:master Jan 30, 2023
Conni2461 pushed a commit that referenced this pull request Feb 19, 2023
macOS 13.x (Ventura, Darwin 22.x) uses `apropos(1)` from FreeBSD, which
does not behave the same as the previous implementation up to macOS 12.

`apropos(1)` takes a regular expression as an argument, so passing "."
causes it to match anything and therefore return all results to be
filtered by Telescope.

(cherry picked from commit d5f6c09)
fschauen added a commit to fschauen/dotfiles that referenced this pull request Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

man_pages not work
3 participants