bugGNU Octave - Bugs: bug #50504, dir() function should include a...

 
 

bug #50504: dir() function should include a "folder" entry for each file

Submitter:  Rik <rik5>
Submitted:  Thu 09 Mar 2017 08:04:44 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  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

Sun 12 Mar 2017 07:42:46 PM UTC, comment #6: 

I also updated your patch to switch from make_absolute_filename to canonicalize_file_name because in cases where the path was already absolute trailing separators could be left (e.g, "/.././").  Checked in here (http://hg.savannah.gnu.org/hgweb/octave/rev/efb139519388).

Thanks for the catch.

Rik <rik5>
Group administrator
Sun 12 Mar 2017 02:36:06 PM UTC, comment #5: 

"test dir" is failing with the recent addition of the field "folder". Additionally, this field should not contain the trailing file separator for compatibility.
Re-opening for these minor issues. The attached patch should fix both.

(file #39976)

Markus Mützel <mmuetzel>
Group administrator
Sat 11 Mar 2017 06:31:16 AM UTC, comment #4: 

I added the folder entry in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/44d51b2b691c).  Fixed, closing report.

Rik <rik5>
Group administrator
Fri 10 Mar 2017 07:45:50 PM UTC, comment #3: 

Thanks for testing.  It's clear that the folder entry needs to be the absolute path name.

Rik <rik5>
Group administrator
Fri 10 Mar 2017 08:36:29 AM UTC, comment #2: 

R2016B on windows: (sine white space deleted from output)


>> version

ans = 9.1.0.441655 (R2016b)

>> pwd

ans = C:\Users\uname\Documents\MATLAB

>> x=dir('dir*/*.txt')

x =
  2×1 struct array with fields:

    name
    folder
    date
    bytes
    isdir
    datenum

>> x.folder
ans = C:\Users\uname\Documents\MATLAB\dir1
ans = C:\Users\uname\Documents\MATLAB\dir2

>> x.name
ans = file1.txt
ans = file2.txt


A.R. Burgers <arb>
Thu 09 Mar 2017 08:19:30 PM UTC, comment #1: 

To support this I need a little bit more information on how Matlab behaves.

If someone can make the following test set of directories and files and then run the test code I would appreciate it.

Test structure


dir1/
  |--file1.txt

dir2/
  |--file2.txt


Test code


x = dir ('dir*/*.txt')
x.folder
x.name


I'm interested in whether the folder is just the directory name of the current directory, or whether it is the full absolute path.

Rik <rik5>
Group administrator
Thu 09 Mar 2017 08:04:44 PM UTC, original submission:  

Matlab has added a "folder" entry to the struct returned from the dir command.  It should be relatively easy to update Octave to be compatible.

Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #39976:  bug50504_dir.patch added by mmuetzel (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Updated the item)
  • -email is unavailable- added by arb (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by rik5
  •  

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-03-12 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-03-12 mmuetzel Attached File- Added bug50504_dir.patch, #39976
        StatusFixed Patch Submitted
        Open/ClosedClosed Open
    2017-03-11 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2017-03-09 rik5 Carbon-Copy- Added larskindermann
        Carbon-Copy- Added sebald

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code