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

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

[Octave-bug-tracker] [bug #59231] Incorrect result of "dir" using wildca


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #59231] Incorrect result of "dir" using wildcards with non-ASCII file names
Date: Thu, 8 Oct 2020 05:06:25 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Edg/85.0.564.70

Update of bug #59231 (project octave):

                  Status:                    None => Confirmed              
                 Release:                   5.2.0 => dev                    
                 Summary: incorrect result of "glob" function handling with
non-english file names => Incorrect result of "dir" using wildcards with
non-ASCII file names

    _______________________________________________________

Follow-up Comment #3:

Unfortunately, that doesn't work on Windows with Octave 6.0.91 or the current
default branch (Octave 7).

We are using the `glob` function provided by gnulib. Gnulib doesn't provide a
Unicode interface on Windows. Unfortunately that means that input and output
is limited to ASCII characters.

Since there is no one-to-one equivalent of `glob` on Windows, the only way I
see is to use alternative functions from the WinAPI. Maybe, we could use
`FindFirstFileW` which looks like it will support the wildcard patterns "?"
and "*". And then build the list from calling `FindNextFileW` repeatedly.
Almost exactly what we are doing for `octave::sys::get_dirlist` already:
https://hg.savannah.gnu.org/hgweb/octave/file/500011ff7e3e/liboctave/system/lo-sysdep.cc#l103

It also looks like those functions don't support any other patterns (like
"[ab]").
We already have `__wglob__` which takes that difference into account.
`dir.m` calls `__wglob__`. So, it would probably be reasonable to make the
proposed change to `__wglob__` only.

I don't see a fix for `glob` that wouldn't mean reimplementing most of
gnulib's `glob` which is probably out of Octave's scope. I'd suggest to add a
note to the docstring of `glob` that mentions that it won't work for files
with non-ASCII characters on Windows.
It's more important to have a working `dir` function imho.

Re-titling accordingly.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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