bugGNU Octave - Bugs: bug #57776, "dir" fails on the root...

 
 

bug #57776: "dir" fails on the root directory of Windows UNC shares

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Sun 09 Feb 2020 11:42:43 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 22 Feb 2020 01:14:26 PM UTC, comment #5: 

Works for me now.
Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Sun 09 Feb 2020 09:29:09 PM UTC, comment #4: 

I pushed this change that fixes the issues described in comment #0 for me:
http://hg.savannah.gnu.org/hgweb/octave/rev/372f42f122bd

Marking as Ready For Test.

Markus Mützel <mmuetzel>
Group administrator
Sun 09 Feb 2020 03:14:23 PM UTC, comment #3: 

@Philip: I think you have been on to something. This code snippet from file_stat::update_internal (in file-stat.cc @ line 192) removes trailing slashes on Windows unless "full_file_name" is a root (like "C:\"):

#if defined (__WIN32__)
          // Remove trailing slash.
          if (full_file_name.length () > 1
              && sys::file_ops::is_dir_sep (full_file_name.back ())
              && ! (full_file_name.length () == 3 && full_file_name[1] == ':'))
            full_file_name.pop_back ();
#endif


Probably, this should also NOT remove the trailing slash if "full_file_name" is a UNC root (like "\\SERVER\share\").

Sure enough, I see the following:

>> [st, err, msg] = lstat ('\\SERVER\share\')
st = [](0x0)
err = -1
msg = No such file or directory
>> [st, err, msg] = lstat ('\\SERVER\share\\')
st =

  scalar structure containing the fields:

    dev = 3
    ino = 0
    mode = 16895
    modestr = drwxrwxrwx
    nlink = 1
    uid = 0
    gid = 0
    rdev = 3
    size = 0
    atime = 3.1553e+08
    mtime = 3.1553e+08
    ctime = 3.1553e+08
    blksize = NaN
    blocks = NaN

err = 0
msg =


Markus Mützel <mmuetzel>
Group administrator
Sun 09 Feb 2020 01:07:02 PM UTC, comment #2: 

Same behavior with trailing backslashes.
Also note that the ".." entry is missing in the second case.

Markus Mützel <mmuetzel>
Group administrator
Sun 09 Feb 2020 01:04:18 PM UTC, comment #1: 

Does it work if you add a trailing backslash?
Maybe related: the GUI file browser doesn't accept "C:" but does accept "C:\". So there is something special with root directories.

Philip Nienhuis <philipnienhuis>
Group Member
Sun 09 Feb 2020 11:42:43 AM UTC, original submission:  

Trying to list the directory content of a root folder of a UNC share on Windows results in an error:

>> dir ('\\SERVER\share')
warning: dir: nonexistent directory '\\SERVER\share'
warning: called from
    dir at line 193 column 5


It does work to list the content of a sub-directory in the share (albeit displaying a warning):

>> dir ('\\SERVER\share\test')
warning: dir: 'lstat (\\SERVER\share\test\..)' failed: No such file or directory
warning: called from
    dir at line 132 column 9

.                 a                 test.txt          test_unc.m
Octave (GUI).lnk  b                 test_octave.bat


Both commands should succeed without displaying a warning.

Markus Mützel <mmuetzel>
Group administrator

 

(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 mmuetzel (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-02-22 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-02-09 mmuetzel StatusNone Ready For Test

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code