octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57664] dir() function folder element is empty


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #57664] dir() function folder element is empty for Windows UNC network-based files
Date: Sat, 25 Jan 2020 01:02:06 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

URL:
  <https://savannah.gnu.org/bugs/?57664>

                 Summary: dir() function folder element is empty for Windows
UNC network-based files
                 Project: GNU Octave
            Submitted by: sebald
            Submitted on: Sat 25 Jan 2020 06:02:04 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.1.90
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

I used the latest beta version of Octave for Windows and ran across an issue
in which the "folder" field of the structure returned from the dir() function
is empty for something like the following UNC path:


rslt = dir("//hostname/path/to/directory");


However, the dir() routine and other file-access routines are able to handle
UNC paths without a problem.

It comes down to the following hunk of code in dir():


        tmpdir = regexprep (fn, re, '$1');
        fn = regexprep (fn, re, '$2$3');
        info(i).name = fn;
        if (! strcmp (last_dir, tmpdir))
          ## Caching mechanism to speed up function
          last_dir = tmpdir;
          last_absdir = canonicalize_file_name (last_dir);
        endif
        info(i).folder = last_absdir;

In particular, the line

          last_absdir = canonicalize_file_name (last_dir);

is the only line that appears to not behave as expected.

The first question to ask is should "folder" report something?  It's not
obvious it should because I'm aware that UNC paths are kind of odd from the
DOS perspective.  There may even be some Windows utilities that need UNC paths
mapped to a network drive in order to access the share volume.  But, as I
pointed out, UNC paths seem fine otherwise in Octave.

The second question is why does canonicalize_file_name() fail?  Is it because
it is a C-library routine and therefore works at the OS (DOS) level?  Would
some other routine be needed if the beginnings of a UNC path is identified?

Some references:

https://savannah.gnu.org/bugs/?50504
https://savannah.gnu.org/bugs/?55448




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57664>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]