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

fish doesn't tab complete some man pages #2087

Closed
c02y opened this issue May 22, 2015 · 12 comments
Closed

fish doesn't tab complete some man pages #2087

c02y opened this issue May 22, 2015 · 12 comments
Assignees
Milestone

Comments

@c02y
Copy link

c02y commented May 22, 2015

For example, pthread_mutex_init or pthread_mutex_destory will not be tab-completed in fish which can be tab-completed under bash if I installed bash-completion package. In fish, I have to type man pthread_mutex_init completely to view the man page, and I already did fish_update_completions before this.

If I type man pthread_mutex_ then TAB, it only show 2 APIs which doesn't include pthread_mutex_init or pthread_mutex_destory.

Weird thing is, in fish, the tab-completion for pthread_mutex_init or pthread_mutex_destory works fine in Ubuntu 14.04 but not in CentOS 6.5, the fish in both disstributions is v2.2b1 installed from the tar.gz file at fishshell.com/beta

@zanchey
Copy link
Member

zanchey commented May 22, 2015

What does apropos pthread_mutex_ show?

@ridiculousfish
Copy link
Member

I can reproduce this on my Ubuntu Trusty install, but for some reason I don't actually have any pthread_mutex man pages. I have pthread_attr_destroy and friends, but none of the mutex ones. Weird.

@c02y
Copy link
Author

c02y commented May 22, 2015

@zanchey What does apropos pthread_mutex_ show?

In CentOS 6.5:

  1. apropos pthread_mutex_ then Enter in fish will show 8 items including pthread_mutex_init and pthread_mutex_destory, same as man pthread_mutex_ then TAB in bash.

  2. apropos pthread_mutex_ then TAB in fish will show only 7 items (each item is in one line with comment in ()):

    pthread_mutex_getprioceiling ....(...)
    pthread_mutex_getprioceiling] ...(...)
    pthread_mutex_init ...(...)
    pthread_mutex_init] ...(...)
    pthread_mutex_lock ...(...)
    pthread_mutex_lock] ...(...)
    pthread_mutex_timedlock ...(...)

note the same item with "]" at the end, and the other items in the result of 1 (8 items) are missing. WEIRD.

In Ubuntu 14.04:
In both bash and fish, the results of commands in 1 and 2 mentioned above contain 8 items as 1.

@c02y
Copy link
Author

c02y commented May 22, 2015

@ridiculousfish I don't actually have any pthread_mutex man pages.

you mean you see no result even typing the whole man pthread_mutex_init?

@zanchey
Copy link
Member

zanchey commented May 22, 2015

You'll need manpages-posix-dev installed on Ubuntu.

@c02y
Copy link
Author

c02y commented May 22, 2015

@zanchey

You'll need manpages-posix-dev installed on Ubuntu.

They are fine for me in my Ubuntu, I think you mean @ridiculousfish should install manpages-posix-dev in his Ubuntu.

@zanchey
Copy link
Member

zanchey commented May 22, 2015

I think you mean @ridiculousfish should install manpages-posix-dev in his Ubuntu.

Yes, of course.

Anyway, the underlying problem is that the output of apropos on CentOS is not handled by the __fish_complete_man awk script. For the record, parsing this output sucks.

@zanchey zanchey added this to the next-2.x milestone May 22, 2015
@Skyfold
Copy link

Skyfold commented Nov 25, 2015

May be related: Bash gives me more completion options for git remotes. Fish does not complete set* (set-url, set-head, set-branches). I tried this on a Fedora box with bash completions installed. I get the same missing completions on OSX.

@faho
Copy link
Member

faho commented Nov 25, 2015

@Skyfold: Nope, not related. This is about CentOS's weird apropos which the man page parser can't currently handle. The git completions are hand-written (and pretty much have to be, since there's no way to write a parser to that level of detail).

I've now opened #2567 to track that.

@zanchey zanchey self-assigned this Nov 26, 2015
zanchey added a commit that referenced this issue Dec 4, 2015
Adds support for the man-db alias format used in CentOS/RHEL 5
Adds basic support for the output of apropos on Solaris

Work on #2087.
@zanchey
Copy link
Member

zanchey commented Dec 4, 2015

I think this should be fixed with ef67fc7, though I'd appreciate some testing.

The input I used for testing is:

## Debian 8
Printf (3o)          - Formatted output functions.
ber_printf (3)       - OpenLDAP LBER simplified Basic Encoding Rules library routines for encoding
caca_conio_cprintf (3caca) - The libcaca public header.
caca_conio_printf (3caca) - The libcaca public header.
printf (1)           - format and print data
printf (1posix)      - write formatted output
printf (3)           - formatted output conversion
printf (3posix)      - print formatted output
set_matchpathcon_printf (3) - set flags controlling the operation of matchpathcon or matchpathcon_index and configure the behaviour of validity checking and error displaying
## CentOS 5
asprintf             (3)  - print to allocated string
dprintf              (3)  - print to a file descriptor
fprintf [printf]     (3)  - formatted output conversion
fprintf [printf]     (3p)  - print formatted output
fwprintf [wprintf]   (3)  - formatted wide character output conversion
fwprintf [wprintf]   (3p)  - print formatted wide-character output
printf               (1)  - format and print data
printf               (1p)  - write formatted output
printf               (3)  - formatted output conversion
printf               (3p)  - print formatted output
printf [builtins]    (1)  - bash built-in commands, see bash(1)
## OS X 10.11
format(ntcl)             - Format a string in the style of sprintf
fwkpfv(1)                - FireWire kprintf viewer
printf(1)                - formatted output
xprintf(5)               - extensible printf
## FreeBSD 10.1
ber_alloc_t(3), ber_flush(3), ber_flush2(3), ber_printf(3), ber_put_int(3), ber_put_enum(3), ber_put_ostring(3), ber_put_string(3), ber_put_null(3), ber_put_boolean(3), ber_put_bitstring(3), ber_start_seq(3), ber_start_set(3), ber_put_seq(3), ber_put_set(3) - OpenLDAP LBER simplified Basic Encoding Rules library routines for encoding
curl_maprintf(3), curl_mfprintf(3), curl_mprintf(3), curl_msnprintf(3), curl_msprintf curl_mvaprintf(3), curl_mvfprintf(3), curl_mvprintf(3), curl_mvsnprintf(3), curl_mvsprintf(3) - formatted output conversion
gprintf(1), printf(1)    - format and print data
builtin(1), !(1), %(1), .(1), :(1), @(1), [(1), {(1), }(1), alias(1), alloc(1), bg(1), bind(1), bindkey(1), break(1), breaksw(1), builtins(1), case(1), cd(1), chdir(1), command(1), complete(1), continue(1), default(1), dirs(1), do(1), done(1), echo(1), echotc(1), elif(1), else(1), end(1), endif(1), endsw(1), esac(1), eval(1), exec(1), exit(1), export(1), false(1), fc(1), fg(1), filetest(1), fi(1), for(1), foreach(1), getopts(1), glob(1), goto(1), hash(1), hashstat(1), history(1), hup(1), if(1), jobid(1), jobs(1), kill(1), limit(1), local(1), log(1), login(1), logout(1), ls-F(1), nice(1), nohup(1), notify(1), onintr(1), popd(1), printenv(1), printf(1), pushd(1), pwd(1), read(1), readonly(1), rehash(1), repeat(1), return(1), sched(1), set(1), setenv(1), settc(1), setty(1), setvar(1), shift(1), source(1), stop(1), suspend(1), switch(1), telltc(1), test(1), then(1), time(1), times(1), trap(1), true(1), type(1), ulimit(1), umask(1), unalias(1), uncomplete(1), unhash(1), unlimit(1), unset(1), unsetenv(1), until(1), wait(1), where(1), which(1), while(1) - shell built-in commands
printf(1)                - formatted output
printf(3), fprintf(3), sprintf(3), snprintf(3), asprintf(3), dprintf(3), vprintf(3), vfprintf(3), vsprintf(3), vsnprintf(3), vasprintf(3), vdprintf(3) - formatted output conversion
printf(9), uprintf(9), tprintf(9), log(9) - formatted output conversion
## Solaris 11

1. printf(1) /usr/share/man/man1/printf.1
_^Hp_^Hr_^Hi_^Hn_^Ht_^Hf - write formatted output

2. printf(3c) /usr/share/man/man3c/printf.3c
_^Hp_^Hr_^Hi_^Hn_^Ht_^Hf, fprintf, sprintf, snprintf, asprintf - print formatted output

3. gprintf(1) /usr/share/man/man1/gprintf.1
_^Hp_^Hr_^Hi_^Hn_^Ht_^Hf - format and print data

Yes, those are embedded backspaces, just in case you're still using Solaris with a line printer. col -b will clean them up, but I haven't added support for that yet.

@c02y
Copy link
Author

c02y commented Dec 4, 2015

@zanchey Yes, I just compile and install the fish from the latest source code, it works as expected. Thanks.

Platform: CentOS 6.5 32-bit

@zanchey
Copy link
Member

zanchey commented Dec 10, 2015

Hooray!

@zanchey zanchey closed this as completed Dec 10, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants