bugGNU Octave - Bugs: bug #42291, auto-quote filenames containing...

 
 

bug #42291: auto-quote filenames containing operators on tab completion with command syntax

Submitted by:  None
Submitted on:  Sun 04 May 2014 11:40:54 PM UTC  
 
Category:  Interpreter Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Duplicate Assigned to:  None
Originator Name:  Frederick Robinson Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  dev
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)

Sat 12 Sep 2015 09:20:07 PM UTC, comment #8: 

I think this is solved by the patches attached to bug #34624 and bug #44095, without the need to insert quotes. One of those patches or a combination of them will likely solve the root problem here, I'm going to close this one as a duplicate because I think the others have this covered between them.

Mike Miller <mtmiller>
Project Administrator
Thu 08 May 2014 11:59:10 PM UTC, comment #7: 

Er, that's patch #7584.

I don't think bug #34444 is quite the same thing, as that has to do with the transpose operator being considered as a quoted string delimiter. This does seem quite the same as bug #34624, though.

So there is patch #7584 and there is also a patch on bug #34624. If someone wants to evaluate either or both of these and see if they address the problem here, please do.

Mike Miller <mtmiller>
Project Administrator
Tue 06 May 2014 06:00:46 PM UTC, comment #6: 

This seems like a duplicate of bug #34624 and  bug #34444. We also have patch #7548.

I'm not sure how to arrange all of these and which one should be the canonical location to keep discussing this bug.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Tue 06 May 2014 12:15:24 PM UTC, comment #5: 

Ok, well I'll reopen and retitle to reflect that as a feature request. If anyone comes up with another way to address the problem of tab completion of filenames in command syntax mode where the names may contain spaces or operator characters, feel free to retitle this again.

Mike Miller <mtmiller>
Project Administrator
Tue 06 May 2014 12:11:33 AM UTC, comment #4: 

I think that readline has this capability. I know that bash (which I believe uses readline) will expand ~ in a filename if you have the appropriate setting set.

Whether or not it would be too hard / not worth it to implement this though I don't know. I've been reading the readline docs / Octave source a bit and frankly I'm a bit lost.

It might be that all that is necessary is just to modify

octave_rl_filename_completion_function in /octave/liboctave/util/oct-rl-edit.c

but it's also quite likely that I'm being overly optimistic and not realy understanding how things work.

Frederick Robinson <frrad>
Mon 05 May 2014 11:02:32 PM UTC, comment #3: 

I don't think it's possible for readline to go backwards and rewrite what you have already entered. So the opening quote would have to have been entered by you already.

Mike Miller <mtmiller>
Project Administrator
Mon 05 May 2014 10:55:46 PM UTC, comment #2: 

Thanks for the explanation, that makes a lot of sense. I still think that this behavior is undesirable though.

As a user, when I press tab, I think I am asking the program "complete this with the longest file/folder name prefix you can" In this case though (if I understand correctly) the completion it offers (mlclass-ex) is not a valid prefix at all, but rather the difference of two strings.

As for a fix, how about using the quote method that you mention. Whenever the autocomplete adds a piece of filename which includes an operator it could add an opening quote too (if not already present). So we'd have

>cd ml<tab>
>cd 'mlclass-ex
>cd 'mlclass-ex1<tab>
>cd 'mlclass-ex1/'

Frederick Robinson <frrad>
Mon 05 May 2014 01:23:06 PM UTC, comment #1: 

Confirmed, but not a bug. This is because the files have hyphens in them and you are using command syntax (no parentheses, bare words treated as strings). Remember that the minus sign is an operator in Octave, so it is delimiting the tokens "mlclass" and "ex".

Fortunately, there is an easy workaround. If you use single or double quotes around files, you should not see this problem and tab complete will even add the closing quote for you.

Yes it is an odd interaction with filename completion when using command syntax, but I don't see much that could be done about it, other than filtering out all files that contain operators so you wouldn't be able to complete on them at all.

But feel free to respond if you think this should be fixed or you do see a way to address it without taking away current functionality.

Mike Miller <mtmiller>
Project Administrator
Sun 04 May 2014 11:40:54 PM UTC, original submission:  

I'm in the following directory:

> ls -la

total 1116
drwxr-xr-x  7 frederick frederick   4096 May  4 16:23 .
drwxr-xr-x 30 frederick frederick   4096 Apr 29 00:15 ..
-rw-r--r--  1 frederick frederick 514132 Nov  7 14:43 ex1.pdf
-rw-r--r--  1 frederick frederick 256432 Nov  7 14:48 ex2.pdf
-rw-r--r--  1 frederick frederick 330389 Nov 11 09:39 ex3.pdf
drwxr-xr-x  8 frederick frederick   4096 May  4 15:15 .git
-rw-r--r--  1 frederick frederick     13 May  4 15:13 .gitignore
drwxr-xr-x  2 frederick frederick   4096 Apr 14 11:36 mlclass-ex1
drwxr-xr-x  2 frederick frederick   4096 May  4 15:06 mlclass-ex2
drwxr-xr-x  2 frederick frederick   4096 Feb 18 12:49 mlclass-ex3
drwxr-xr-x  2 frederick frederick   4096 May  4 15:09 zips

Typing

>cd ml<tab>

gets me

>cd mlclass-ex

(all good so far), but then I continue

>cd mlclass-ex1<tab>

which results in

>cd mlclass-ex1.pdf

(not so good)

of course I can avoid this by not hitting this second tab, but I think this is still probably not desired behaviour.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by frrad (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (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 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-09-12 mtmiller Dependencies- => Depends on bugs #34624
    2015-09-12 mtmiller Open/ClosedOpen => Closed
        Dependencies- => Depends on bugs #44095
    2014-05-06 jordigh StatusConfirmed => Duplicate
    2014-05-06 mtmiller Severity3 - Normal => 1 - Wish
        Item GroupIncorrect Result => Feature Request
        StatusWont Fix => Confirmed
        Open/ClosedClosed => Open
        Release3.8.1 => dev
        Operating SystemGNU/Linux => Any
        Summarytab completion gives incorrect filenames when filename contains operators => auto-quote filenames containing operators on tab completion with command syntax
    2014-05-05 mtmiller StatusNone => Wont Fix
        Open/ClosedOpen => Closed
        Summarytab completion gives incorrect filenames => tab completion gives incorrect filenames when filename contains operators

    Back to the top


    Powered by Savane 3.5