#535851 zsh: completion does not work anymore with some specific applications

Package:
zsh
Source:
zsh
Description:
shell with lots of features
Submitter:
Sylvain Chevillard
Date:
2025-06-06 15:43:02 UTC
Severity:
important
#535851#5
Date:
2009-07-05 15:09:16 UTC
From:
To:
Since a while, zsh does not complete anymore when used with some applications that open specific file types.

For instance, when I write:
xpdf <tab>
I used to have a completion list containing all (and only) pdf files within the current directory.

Now, nothing happens when using tab, as if the completion list were empty (even subdirectories are not listed).

The same problem appears with acroread and gv.

The bug does not affect all the applications: for instance
emacs <tab>
keeps printing the list of all possible completions.

I observe the bug on at least two computers running a testing distribution.
I tried removing .zshrc and creating a new one with the interactive wizzard offered by zsh at first login. The problem remains.

#535851#10
Date:
2009-07-05 18:25:05 UTC
From:
To:
Did you try removing your .zcompdump file and restarting zsh?
#535851#15
Date:
2009-07-05 19:17:34 UTC
From:
To:
I just tried: at first restart, zsh regenerates exactly the same
.zcompdump and of course, the problem remains unsolved.

By the way, I forgot to say that I observed the problem also with
latex/pdflatex:

latex <tab>
does not propose any completion.

#535851#20
Date:
2009-07-10 23:42:11 UTC
From:
To:
What output does <Ctrl-X><h> produce in that position?
#535851#25
Date:
2009-07-17 14:36:17 UTC
From:
To:
Clint Adams a écrit :

tags in context :completion::complete:latex::
    globbed-files  (_files _tex (eval))

#535851#30
Date:
2009-07-18 13:13:38 UTC
From:
To:
I get

tags in context :completion::complete:latex::
    globbed-files  (_files _tex (eval))
    directories    (_files _tex (eval))
    all-files      (_files _tex (eval))


Could you try the same after running

zsh -f

then

autoload -U compinit;compinit

#535851#35
Date:
2009-08-02 10:08:24 UTC
From:
To:
Clint Adams a écrit :

This time I get the same thing as you (and zsh propose me the good
completion list).

#535851#40
Date:
2009-08-02 15:26:42 UTC
From:
To:
Can you try adding things from your config one-by-one until you find
the line that causes the problem?

#535851#45
Date:
2009-08-04 14:54:38 UTC
From:
To:
Clint Adams <schizo@debian.org> a écrit :

The line that causes trouble is the following:

zstyle ':completion:*' file-sort access

#535851#50
Date:
2009-08-05 00:24:59 UTC
From:
To:
*.(#i)pdf(oa#q-.)

I hope this does the right thing.

Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.45
diff -u -r1.45 _path_files
--- Completion/Unix/Type/_path_files	13 Mar 2009 09:59:58 -0000	1.45
+++ Completion/Unix/Type/_path_files	5 Aug 2009 00:23:32 -0000
@@ -160,7 +160,7 @@
       if _have_glob_qual "$tmp1" complete; then
 	# unbalanced parenthesis is correct: match[1] contains the start,
 	# match[5] doesn't contain the end.
-	tmp2+=( "${match[1]}${sort}${match[5]})" )
+	tmp2+=( "${match[1]}${match[5]})(${sort})" )
       else
         tmp2+=( "${tmp1}(${sort})" )
       fi

#535851#55
Date:
2009-08-05 00:45:33 UTC
From:
To:
Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.46
diff -u -r1.46 _path_files
--- Completion/Unix/Type/_path_files	5 Aug 2009 00:28:34 -0000	1.46
+++ Completion/Unix/Type/_path_files	5 Aug 2009 00:44:46 -0000
@@ -160,7 +160,7 @@
       if _have_glob_qual "$tmp1" complete; then
 	# unbalanced parenthesis is correct: match[1] contains the start,
 	# match[5] doesn't contain the end.
-	tmp2+=( "${match[1]}${match[5]})(${sort})" )
+	tmp2+=( "${match[1]}#q${sort})(${match[5]})" )
       else
         tmp2+=( "${tmp1}(${sort})" )
       fi

#535851#60
Date:
2012-01-30 21:34:37 UTC
From:
To:
Hi Sylvain,

can you try to reproduce this issue, please?

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=535851

#535851#65
Date:
2025-06-06 15:34:56 UTC
From:
To:
for me. These problems were caused by a faulty $FPATH.  It contained
the path "/usr/local/share/zsh/site-functions" (with "local"), so the
functions in "/usr/share/zsh/site-functions" (without "local") were not
found.  Adding "/usr/share/zsh/site-functions" to $FPATH solved the
problem.

This does not explain all the effects that I have seen: On Bookworm
completion is working in spite of the fact that $FPATH is faulty as
well. Nor does it explain some of the effects described here.

I do not know whether this is the same problem, but this information
might help – and $FPATH should be fixed.

Joerg Ebertz