bugGNU Octave - Bugs: bug #40989, ls fails if blank spaces exist in...

 
 

bug #40989: ls fails if blank spaces exist in filepath

Submitted by:  Felipe G. Nievinski <fgnievinski>
Submitted on:  Sun 22 Dec 2013 09:27:55 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: Microsoft Windows

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 Jump to the original submission)

Tue 07 Jan 2014 11:16:24 PM UTC, comment #8:

I fixed things up here (http://hg.savannah.gnu.org/hgweb/octave/rev/3d22b24863b9).

Rik <rik5>
Project Administrator
Thu 02 Jan 2014 07:46:03 PM UTC, comment #7:

There is a problem with cset 05a53cc522b7 (http://hg.savannah.gnu.org/hgweb/octave/rev/05a53cc522b7) so I am re-opening the bug. The patch wraps all non-options in double quote characters. However, following the wrapping there is a regexprep call which escapes all non-word characters like the double quote character. This makes ls unusuable whenever you have an actual file name. See the following example:

You might get away with modifying the regexprep to not include double quotes on line 80 of ls.m

But I haven't thought through all of the implications.

Rik <rik5>
Project Administrator
Mon 30 Dec 2013 10:21:20 PM UTC, comment #6:

works on linux, too:

'c' is a script from the file /home/fgnievinski/a b/c.m

Felipe G. Nievinski <fgnievinski>
Sun 29 Dec 2013 07:06:31 PM UTC, comment #5:

addpath doesn't seem to have any problem with spaces:

mkdir('a b')
system('touch "a b/c.m"')
addpath('a b')
which c
rmpath('a b')
delete('a b/c.m')
rmdir('a b')

returns:

'c' is a script from the file C:\Users\fgnievinski\a b\c.m

can you confirm on linux?

Felipe G. Nievinski <fgnievinski>
Sun 29 Dec 2013 03:16:59 PM UTC, comment #4:

Thanks, I have pushed your patch:

http://hg.savannah.gnu.org/hgweb/octave/rev/05a53cc522b7

I don't know about addpath. Can you test yourself? The most common situation of spaces in the path occurs in Windows, and I don't have access to Windows. So far we have recommended people to simply avoid spaces in the path. I suspect that the problem lies deeper than the simple fix for ls that you have provided.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 25 Dec 2013 12:57:05 PM UTC, comment #3:

here's the mercurial patch

I don't know about addpath -- should a separate bug be opened?

(file #30090)

Felipe G. Nievinski <fgnievinski>
Tue 24 Dec 2013 09:34:15 PM UTC, comment #2:

Sorry, I see you did use "endif". We prefer to use ! for negation instead of ~.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 24 Dec 2013 09:33:18 PM UTC, comment #1:

We prefer Octave style in m-files, not Matlab style. Can you please look at the style of the code you're patching and follow it? For example, no single-quoted strings, spaces before ( in function calls but not in indexing calls, informative closing block statements (e.g. endif, not plain end).

Also, can you please produce hg csets instead of plain diffs?

As to the content of the patch itself, I think this doesn't fundamentally solve the problem with spaces in the pathname. For example, does addpath work correctly if there are spaces?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Sun 22 Dec 2013 09:27:55 PM UTC, original submission:

without the patch attached these calls fail:

ls('c:\program files')
ls('c:\program files\w*')
ls('/od', 'c:\program files')

Felipe G. Nievinski <fgnievinski>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #30090:  bug40989.patch added by fgnievinski (1KiB - application/octet-stream)
file #30067:  ls.m.diff added by fgnievinski (277B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by fgnievinski (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 07 Jan 2014 11:16:24 PM UTCrik5StatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Thu 02 Jan 2014 07:46:03 PM UTCrik5StatusFixed=>In Progress
      Open/ClosedClosed=>Open
    Sun 29 Dec 2013 03:16:59 PM UTCjordighStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 25 Dec 2013 12:57:05 PM UTCfgnievinskiAttached File-=>Added bug40989.patch, #30090
    Sun 22 Dec 2013 09:27:55 PM UTCfgnievinskiAttached File-=>Added ls.m.diff, #30067

    Back to the top


    Powered by Savane 3.1-cleanup1