changeset 30961:42cf34140699 stable

ls.m: Fix handling of '\' on UNIX platforms (bug #62282) * ls.m: Change regexp to escape special characters to not modify already escaped sequences such as '\*'.
author Rik <rik@octave.org>
date Fri, 22 Apr 2022 07:43:33 -0700
parents d585976cb30a
children b9e4d91d20ce 9a9374ed5270
files scripts/miscellaneous/ls.m
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/ls.m	Fri Apr 22 08:54:49 2022 +0200
+++ b/scripts/miscellaneous/ls.m	Fri Apr 22 07:43:33 2022 -0700
@@ -91,7 +91,7 @@
       endif
     else
       ## Escape any special characters in filename
-      args = regexprep (args, '([^][\w.*?-])', '\\$1');
+      args = regexprep (args, '(?<!\\)([^][\w.*?-\\])', '\\$1');
       ## Undo escaped spaces following command args
       ## Only used for command form where single str contains many args.
       ## Example: list = ls ("-l /usr/bin")