bugGNU Octave - Bugs: bug #50500, Behavior of dir() changed and is...

 
 

bug #50500: Behavior of dir() changed and is different from Matlab now

Submitted by:  Lars Kindermann <larskindermann>
Submitted on:  Wed 08 Mar 2017 10:39:39 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

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)

Thu 09 Mar 2017 07:51:50 PM UTC, comment #9:

Matlab must have added the ".folder" property sometime since dir was originally coded. Just to be clear, I'll make a new bug report for that and fix it there.

Rik <rik5>
Project Administrator
Thu 09 Mar 2017 08:49:22 AM UTC, comment #8:

Works for me!

As you're in the code right now, what about adding a ".folder" field containing the just cut path information for matlab compatibility?

Lars Kindermann <larskindermann>
Thu 09 Mar 2017 05:38:47 AM UTC, comment #7:

Pulling the changeset took some time, even though it was visible on the HTML log page. Maybe some servers in between needed updating. The change seems to work. Thanks.

Dan Sebald <sebald>
Thu 09 Mar 2017 05:13:09 AM UTC, comment #6:

I tweaked the regular expression in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/99ee4dd83ceb). This is ready for testing.

Rik <rik5>
Project Administrator
Thu 09 Mar 2017 03:27:07 AM UTC, comment #5:

I should have put that expression in verbatim:

Dan Sebald <sebald>
Thu 09 Mar 2017 03:25:57 AM UTC, comment #4:

I'm not as familiar with regexp family commands as I should be, but it does seem like that regexprep() command is attempting to remove the path, but apparently not quite correctly. Here's the expression after the file separator is printed:

(?:^|^.+[/])([^/.].[^/])?$

That front () is $1, correct? The second () is $2? So why is the regexprep using $1, rather than $2?

I would think that the file name is on the right side, i.e., $2, and the expression should be fashioned so that $1 comes out '' if there is no path.

Also, it seems that spaces in file names act the same, but may want to test that works.

Dan Sebald <sebald>
Thu 09 Mar 2017 02:25:22 AM UTC, comment #3:

Yes, the dir speed-increase. Probably this changeset:

http://hg.savannah.gnu.org/hgweb/octave/rev/529c6d0c6684

The first code hunk diff looks consistent. The second one looks like it might not be discarding the leading the path like the original:

The regexprep may also need to replace the front portion ('bin/') with empty string ''.

Dan Sebald <sebald>
Thu 09 Mar 2017 12:01:54 AM UTC, comment #2:

try this way

Lars Kindermann <larskindermann>
Wed 08 Mar 2017 11:29:06 PM UTC, comment #1:

Probably related to bug #50416 which improved the performance of dir about 5X.

However, I'm not seeing this.

Rik <rik5>
Project Administrator
Wed 08 Mar 2017 10:39:39 PM UTC, original submission:

info=dir("folder")

info.name used to contain pure filenames without path but since a few days in current dev .name contains combined "folder/filename" entries. This breaks many scripts.

Matlab returns pure filenames in .name but additionally fills the field .folder with the path info.

Lars Kindermann <larskindermann>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by sebald (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by larskindermann (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 09 Mar 2017 07:51:50 PM UTCrik5StatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Thu 09 Mar 2017 05:13:09 AM UTCrik5StatusWorks For Me=>Ready For Test
    Wed 08 Mar 2017 11:29:06 PM UTCrik5StatusNone=>Works For Me

    Back to the top


    Powered by Savane 3.1-cleanup1