bugGNU Octave - Bugs: bug #60640, syntax error when tab autocomplete...


bug #60640: syntax error when tab autocomplete of @classname folder inserts single quote

Submitted by:  Nicholas Jankowski <nrjank>
Submitted on:  Wed 19 May 2021 07:54:12 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  None Assigned to:  None
Originator Name:  Nicholas Jankowski Open/Closed:  Open
Release:  6.2.0 Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 27 May 2021 11:17:23 PM UTC, comment #10: 

I'm attaching a minimal patch that undoes the installation of the readline hook function that was added for bug #44095.

With this patch applied, Tab no longer inserts extra quote characters at the front of the file name with repeated Tabs. However, it also breaks what that bug was supposed to fix. All I'm showing is that the function octave::gnu_readline::do_completer_word_break_hook is what needs fixing.

(file #51488)

Mike Miller <mtmiller>
Project Administrator
Thu 27 May 2021 03:27:41 PM UTC, comment #9: 

@lachlan 's bugfix on bug #44095 seems to live in cmd-edit.cc and .h, and oct-rl-edit.c and .h.  don't know if that's a clue.

Nicholas Jankowski <nrjank>
Thu 27 May 2021 03:06:50 PM UTC, comment #8: 

Any idea where in the codebase these insertions are happening?  I just solved a difference in the display of scalar structs between Matlab and Octave and the change was not the hard part, it was simply finding where in the codebase the relevant lines were.

Rik <rik5>
Project Administrator
Wed 26 May 2021 12:14:19 AM UTC, comment #7: 

There are actually a couple of different behaviors going on here.

First, Octave is actually doing some work to insert quote characters into the completion results, see bug #44095. This bug was first fixed in version 4.2.0, and I can verify different behavior in version 4.0.3.

I can't reproduce comment #3 on Debian. When I use @<Tab> in a directory with exactly one @ class directory, I get

>> cd '@MyClass/

and subsequent <Tab>s change or add nothing.

I can reproduce comment #2 on Debian, when there are more than one @ class directory in the current working directory, but this is caused by the code added to fix bug #44095. In version 4.0.3, I only get

>> cd '@
@a/ @b/ @c/

and subsequent <Tab>s keep showing the list of possible completions as expected. So it is code in Octave itself that is inserting the extra quotes.

Mike Miller <mtmiller>
Project Administrator
Tue 25 May 2021 05:46:21 PM UTC, comment #6: 

Currently you can't use the GUI (Octave will refuse to start) or interactive graphics (events won't be processed while Octave is waiting for input) without readline enabled because Octave uses a readline feature to execute callback functions while readline is waiting for input at the command prompt.

This is one of the things that the new terminal widget aims to fix.

John W. Eaton <jwe>
Project Administrator
Tue 25 May 2021 05:34:47 PM UTC, comment #5: 

for those of us not familiar with readline, what useful things will get turned off with that switch?

Nicholas Jankowski <nrjank>
Tue 25 May 2021 04:22:05 PM UTC, comment #4: 

If this is a huge problem, try disabling Readline by starting Octave with --no-line-editing.

To truly fix this requires someone who understands Readline and how to configure it through inputrc files.  For anyone who comes along later and wants to give this a go, Octave ships an inputrc file located at scripts/startup/inputrc.

Rik <rik5>
Project Administrator
Mon 24 May 2021 02:36:58 PM UTC, comment #3: 

I see similar but not identical behavior.

In a folder with no class @ folders, @<Tab> does nothing, as expected.

In a folder with a @ subfolder, such as C:\test which contains only @MyClass:

cd <TAB> produces:

cd '@MyClass/

cd <TAB><TAB><TAB> produces:

cd '@MyClass/'@MyClass/'@MyClass/

y = @<Tab>

y = '@MyClass/

A second tab produces nothing, a third produces:

>> y = '@MyClass/
Display all 1739 possibilities? (y or n)

Nicholas Jankowski <nrjank>
Fri 21 May 2021 11:59:47 PM UTC, comment #2: 

This is probably Readline library.  Try typing

y = @<Tab>

For me, Readline inserts one apostrophe (') for each <Tab> that I press.  So,

y = @<Tab><Tab><Tab>


y = '''@

Rik <rik5>
Project Administrator
Wed 19 May 2021 07:57:42 PM UTC, comment #1: 

forgot to note this was tested on Windows, Octave 6.2.1 hg id: 161daebce243

Nicholas Jankowski <nrjank>
Wed 19 May 2021 07:54:12 PM UTC, original submission:  

Tab autocomplete for a class folder starting with @ results in a folder name with a ' at the front, producing a syntax error.

>> pwd
ans = c:\temp\test2

>> mkdir('@testclass')

>> cd @test<Press tab for autocomplete>


>> cd '@testclass/
error: parse error:

  syntax error

> cd '@testclass/
>> cd @testclass/

>> pwd
ans = c:\temp\test2\@testclass

Nicholas Jankowski <nrjank>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #51488:  cmd-edit.patch added by mtmiller (1019B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nrjank
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-27 mtmiller Attached File- => Added cmd-edit.patch, #51488
    2021-05-27 nrjank Carbon-Copy- => Added lachlan

    Back to the top

    Powered by Savane 3.6