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

 
 

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

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  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
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group Member
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>
Group Member
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>
Group 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>
Group Member
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>
Group 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>
Group Member
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>
Group 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>
produces:

y = '@MyClass/


A second tab produces nothing, a third produces:

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


Nicholas Jankowski <nrjank>
Group Member
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>


produces


y = '''@


Rik <rik5>
Group 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>
Group Member
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>

Produces:

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

  syntax error

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

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



Nicholas Jankowski <nrjank>
Group Member

 

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

Attach Files:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group 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.13-02a9.
    Corresponding source code