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

 
 

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

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

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 06 Jun 2022 09:31:17 PM UTC, comment #9: 

Other wildcard characters are not supported by Matlab so the change was made only for `*`.  It wouldn't be that hard to add the others, although checking for escape sequences would require a regular expression.

Rik <rik5>
Group administrator
Sat 14 May 2022 01:12:42 AM UTC, comment #8: 

can you provide an example listing that does not work so it can be tested against?

Nicholas Jankowski <nrjank>
Group Member
Fri 13 May 2022 09:42:13 PM UTC, comment #7: 

It seems, the other wildcard characters ('?', '[', ']') have not been considered in this solution.

Jan Hieronymus <xyhausen>
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>
Group 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>
Group 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>
Group administrator
Thu 03 Sep 2020 10:26:37 PM UTC, comment #3: 

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

Rik <rik5>
Group 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>
Group 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>
Group 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 nrjank (Posted a comment)
  • -email is unavailable- added by xyhausen (Posted a comment)
  • -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)
  •  

    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 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.13-f8d8.
    Corresponding source code