changeset 31066:74d97efb7573

maint: Merge stable to default.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 04 Jun 2022 00:12:55 +0200
parents 451fb63a10a0 (current diff) d33af4594440 (diff)
children 5261a81765b0
files etc/NEWS.7.md
diffstat 2 files changed, 34 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS.7.md	Thu Jun 02 19:56:15 2022 -0400
+++ b/etc/NEWS.7.md	Sat Jun 04 00:12:55 2022 +0200
@@ -47,7 +47,7 @@
 
 ### Documentation
 
-- Fix minor typo in datestr.m.
+- `datestr.m`: Fix minor typo.
 - `ls.m`: Improve wording in docstring (bug #62282).
 - `dir.m`: Clarify wildcard behavior on Windows in docstring (bug #62282).
 - `memory.m`: Redo documentation to be formatted correctly in Info output.
@@ -148,17 +148,19 @@
 between these operators and the variable they affect were allowed.  That
 is no longer the case.
 
-- For compatibility with command syntax, inplace operators (`+=`, `-=`,
-`*=`, `.*=`, `/=`, `./=`, `\=`, `.\=`, `^=`, `.^=`, `|=`, `&=`) must now
-either be followed by a whitespace character or must not be preceded by a
-whitespace character.  For commands with binary operators (`+`, `-`, `*`,
- `.*`, `/`, `./`, `\`, `.\`, `^`, `.^`, `|`, `&`, `||`, `&&`) without
-assignment, the same rules apply.  That was not a requirement in previous
-versions of Octave.
-E.g., `a + b`, `a+ b`, or `a+b` are valid if `a` is a variable.  In
-contrast, `a +b` will throw an error if `a` is a variable.  The latter
-example is now interpreted as command syntax expression equivalent to the
-function syntax expression `a ("+b")`.
+- When an expression involving operators could be interpreted ambiguously
+either as command style syntax or function style syntax, it is
+interpreted as command style syntax in more cases than in previous
+versions.  To still be interpreted as function style syntax, inplace
+operators (`+=`, `-=`, `*=`, `.*=`, `/=`, `./=`, `\=`, `.\=`, `^=`,
+`.^=`, `|=`, `&=`) must now either be followed by a whitespace character
+or must not be preceded by a whitespace character.  For ambiguous
+expressions involving binary operators (`+`, `-`, `*`, `.*`, `/`, `./`,
+`\`, `.\`, `^`, `.^`, `|`, `&`, `||`, `&&`), the same rules apply.
+E.g., `a + b`, `a+ b`, or `a+b` are valid expressions if `a` is a
+variable.  In contrast, `a +b` will throw an error if `a` is a variable.
+The latter example is now interpreted as a command syntax expression
+(equivalent to the function syntax expression `a ("+b")`).
 
 - The `mldivide` function (i.e., the `\` operator) now uses an LU
 decomposition to solve nearly singular full square matrices.  This is
--- a/liboctave/util/oct-glob.cc	Thu Jun 02 19:56:15 2022 -0400
+++ b/liboctave/util/oct-glob.cc	Sat Jun 04 00:12:55 2022 +0200
@@ -253,15 +253,33 @@
           if (xpat.empty ())
             continue;
 
+          std::string dir = "";
+
           // separate component until first file separator
           std::size_t sep_pos
             = xpat.find_first_of (sys::file_ops::dir_sep_chars ());
+
+          // handle UNC paths
+          if (sep_pos == 0 && xpat.length () > 1
+              && sys::file_ops::is_dir_sep (xpat[1]))
+            {
+              // start pattern with a file, i.e., "\\SERVER\share\file"
+              sep_pos = xpat.find_first_of (sys::file_ops::dir_sep_chars (), 2);
+              if (sep_pos != std::string::npos)
+                sep_pos = xpat.find_first_of (sys::file_ops::dir_sep_chars (),
+                                              sep_pos + 1);
+              if (sep_pos != std::string::npos)
+                {
+                  dir = xpat.substr(0, sep_pos);
+                  xpat = xpat.substr (sep_pos+1);
+                  sep_pos = xpat.find_first_of (sys::file_ops::dir_sep_chars ());
+                }
+            }
+
           std::string file = (sep_pos != std::string::npos)
                              ? xpat.substr (sep_pos) : "";
           xpat = xpat.substr (0, sep_pos);
 
-          std::string dir = "";
-
           if ((sep_pos == 2 || xpat.length () == 2) && xpat[1] == ':')
             {
               // include disc root with first file or folder