bugGNU Octave - Bugs: bug #58976, dir('fname/v*') returning v*...

 
 

bug #58976: dir('fname/v*') returning v* contents when only one v* folder present

Submitted by:  None
Submitted on:  Tue 18 Aug 2020 04:12:21 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Holly Gibbs 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)

Thu 10 Sep 2020 02:00:14 AM UTC, comment #6: 

Thank you for fixing this Rik 👍

I can confirmed that the original example now works on the default branch (Octave 7).

Kai Torben Ohlhus <siko1056>
Project Member
Thu 10 Sep 2020 12:02:04 AM UTC, comment #5: 

It's been about a week with no comment.  Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Fri 04 Sep 2020 12:16:10 AM UTC, comment #4: 

I checked in a fix in this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/549c10384cc2.

Marking as Ready for Test.

Rik <rik5>
Project Administrator
Thu 03 Sep 2020 10:26:37 PM UTC, comment #3: 

Marking as "Confirmed" and switching Item Group to "Matlab Compatibility".

Rik <rik5>
Project Administrator
Thu 03 Sep 2020 10:23:57 PM UTC, comment #2: 

My testing with R2020A shows that Matlab always returns the directory name, rather than the contents of the the subdirectory.

So, for a single directory v0 the return value is a scalar struct with the isdir field set to 1.  With multiple directories, it returns a struct array with "v0", "v1", etc. and isdir field set to 1 always.

Rik <rik5>
Project Administrator
Tue 18 Aug 2020 05:22:43 PM UTC, comment #1: 

Hmm, if it followed the behavior of ls on Unix systems, then I would expect it to list the contents of each directory regardless of the number of directories that 'data/v*' matches.

But it appears that Matlab does not recursively list subdirectory contents in this case.  However, it does appear to list subdirectory contents if wildcard characters are not present.  Can someone confirm that?  If so, then this looks like a compatibility issue.

John W. Eaton <jwe>
Project Administrator
Tue 18 Aug 2020 04:12:21 PM UTC, original submission:  

For a directory structure like

data
-v0
-v1
-v...
-vn

When I ask for a list of the v* folders with

>>fold_struct=dir('data/v*')


If there is only one folder (eg. v0) then dir returns the subfolders of v0 instead of a list with just v0.

If there is more than one folder, then dir('data/v*') returns the struct array with v0 v1 v2 ... vn.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-09-10 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2020-09-04 rik5 StatusConfirmed => Ready For Test
    2020-09-03 rik5 Item GroupNone => Matlab Compatibility
        StatusNone => Confirmed
        Release5.2.0 => dev
        Operating SystemMicrosoft Windows => Any

    Back to the top


    Powered by Savane 3.5