Possible bug in ksh tab completion

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible bug in ksh tab completion

Arnaud Bergeron
I noticed that, using ksh, if you try to tab-complete any filename
that has a '[' in it while there are more than one file in the
directory will fail.  Simple example:

$ mkdir test
$ cd test
$ touch [a] [b]
$ pico \[a

at the last line, if you type tab, the system beeps and nothing else
happens.  It is not such a big deal  for files with small names like
the ones in the example but can get annoying if you have to type in
verbatim a 60-caracter filename.

So this leads to my question.  Is it a design feature,  a POSIX
requierment, or simply something that has gone unnoticed?

--
"They allowed us to set up a separate division almost, that is physically,
geographically, psychologically and spiritually different from what Bill
himself calls the Borg"
 - Peter Moore, V.P. in charge of Xbox 360 marketing at Microsoft.

Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in ksh tab completion

Matthias Kilian
On Fri, Nov 18, 2005 at 03:53:38PM -0500, Arnaud Bergeron wrote:
> I noticed that, using ksh, if you try to tab-complete any filename
> that has a '[' in it while there are more than one file in the
> directory will fail.  Simple example:
[...]
> So this leads to my question.  Is it a design feature,  a POSIX
> requierment, or simply something that has gone unnoticed?

ksh would need some kind of incremental parser for both parsing
scripts as well for doing tab-completion. Unfortunately, using a
common parser for normal use (parse a script) and for special
interactive use (completion) isn't trivial. The edit implementations
(both emacs and vi) use lots of ad-hoc stuff.

I'd the idea of using a common parser implemented with yacc(1), but
Otto pointed out that this wouldn't help much but also bloat ksh.

So, for now, completion won't work for some pathological cases ('{',
'@', and other unusual characters).

Fixing this would be more than one or two days of work. But have a
look at at&t ksh -- it even sucks more if it comes to completion.

Ciao,
        Kili

Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in ksh tab completion

Arnaud Bergeron
On 11/18/05, Matthias Kilian <[hidden email]> wrote:

> On Fri, Nov 18, 2005 at 03:53:38PM -0500, Arnaud Bergeron wrote:
> > I noticed that, using ksh, if you try to tab-complete any filename
> > that has a '[' in it while there are more than one file in the
> > directory will fail.  Simple example:
> [...]
> > So this leads to my question.  Is it a design feature,  a POSIX
> > requierment, or simply something that has gone unnoticed?
>
> ksh would need some kind of incremental parser for both parsing
> scripts as well for doing tab-completion. Unfortunately, using a
> common parser for normal use (parse a script) and for special
> interactive use (completion) isn't trivial. The edit implementations
> (both emacs and vi) use lots of ad-hoc stuff.
>
> I'd the idea of using a common parser implemented with yacc(1), but
> Otto pointed out that this wouldn't help much but also bloat ksh.
>
> So, for now, completion won't work for some pathological cases ('{',
> '@', and other unusual characters).

I reported it precisely because the characters you mentionned (and all
other 'special' chars i know) are working perfectly.  '[' and ']' are
the only chars I have problems with even if they are properly escaped.

>
> Fixing this would be more than one or two days of work. But have a
> look at at&t ksh -- it even sucks more if it comes to completion.
>

Now if you still think it would take more than one or two days, I
think I'll try to code myself a little interactive-only shell.

> Ciao,
>         Kili
>
>

--
"They allowed us to set up a separate division almost, that is physically,
geographically, psychologically and spiritually different from what Bill
himself calls the Borg"
 - Peter Moore, V.P. in charge of Xbox 360 marketing at Microsoft.

Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in ksh tab completion

Christian Weisgerber
Arnaud Bergeron <[hidden email]> wrote:

> > So, for now, completion won't work for some pathological cases ('{',
> > '@', and other unusual characters).
>
> I reported it precisely because the characters you mentionned (and all
> other 'special' chars i know) are working perfectly.  '[' and ']' are
> the only chars I have problems with even if they are properly escaped.

I haven't examined this exhaustively, but at least ` (backquote)
is also problematic.

--
Christian "naddy" Weisgerber                          [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in ksh tab completion

Matthias Kilian
In reply to this post by Arnaud Bergeron
On Fri, Nov 18, 2005 at 09:55:26PM -0500, Arnaud Bergeron wrote:
> I reported it precisely because the characters you mentionned (and all
> other 'special' chars i know) are working perfectly.  '[' and ']' are
> the only chars I have problems with even if they are properly escaped.

Oops, you're right, at least '@' seems to work. But as naddy pointed
out, there are still other problematic characters. For example,

$ mkdir -p aaa:bbb/{foo,fee,bar,baz}
$ ls aa^I^I^I

> Now if you still think it would take more than one or two days, I
> think I'll try to code myself a little interactive-only shell.

Is it really worth it? How many often do you run into those completion
bugs, i.e. how much file and directories with funny characters do
you have?

Ciao,
        Kili

--
If your program isn't worth documenting,
it probably isn't worth running.
                -- Nagler

Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in ksh tab completion

Arnaud Bergeron
On 11/19/05, Matthias Kilian <[hidden email]> wrote:

> On Fri, Nov 18, 2005 at 09:55:26PM -0500, Arnaud Bergeron wrote:
> > I reported it precisely because the characters you mentionned (and all
> > other 'special' chars i know) are working perfectly.  '[' and ']' are
> > the only chars I have problems with even if they are properly escaped.
>
> Oops, you're right, at least '@' seems to work. But as naddy pointed
> out, there are still other problematic characters. For example,
>
> $ mkdir -p aaa:bbb/{foo,fee,bar,baz}
> $ ls aa^I^I^I
>
> > Now if you still think it would take more than one or two days, I
> > think I'll try to code myself a little interactive-only shell.
>
> Is it really worth it? How many often do you run into those completion
> bugs, i.e. how much file and directories with funny characters do
> you have?

About 4 new per week.  Current total:  about 650

It's because I download anime and all groups put their names in the
filename inside [].  That's why it's bugging me.  Anyway enough noise
for now.


>
> Ciao,
>         Kili
>
> --
> If your program isn't worth documenting,
> it probably isn't worth running.
>                 -- Nagler
>
>


--
B+ De toutes les machines que j'ai vues, le Macintosh est la seule qui
apporte une certaine originalitC) B; Bill Gates

Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in ksh tab completion

Han Boetes
Arnaud Bergeron wrote:
> About 4 new per week.  Current total:  about 650
>
> It's because I download anime and all groups put their names in
> the filename inside [].  That's why it's bugging me.  Anyway
> enough noise for now.

In that case, consider using zsh for your shell.



# Han