[PATCH consfigurator] WRITE-REMOTE-FILE: accept more spaces in output from "ls -nd".

David Bremner david at tethera.net
Sat Jun 21 10:30:13 BST 2025


This is needed to work with the "ls -nd" output from busybox, used in OpenWRT
among other places.  For consistency this also changes "..?" after the mode to
"[ ]+".  I verified that at least on FreeBSD, "ls -nd" does indeed uses spaces
after the mode, while GNU coreutils "ls -nd" uses a single space.

Signed-off-by: David Bremner <david at tethera.net>
---
 src/connection.lisp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/connection.lisp b/src/connection.lisp
index bb5e29d..3c0c29f 100644
--- a/src/connection.lisp
+++ b/src/connection.lisp
@@ -645,7 +645,7 @@ specification of POSIX ls(1))."
       ;; --reference for chmod(1) and chown(1) is not POSIX
       (flet ((dehyphen (s) (delete #\- s)))
         (multiple-value-bind (match groups)
-            (re:scan-to-strings #?/^.(...)(...)(...)..?[0-9]+ ([0-9]+) ([0-9]+) /
+            (re:scan-to-strings #?/^.(...)(...)(...)[ ]+[0-9]+[ ]+([0-9]+)[ ]+([0-9]+) /
                                 (run :env '(:LOCALE "C") "ls" "-nd" pathname))
           (unless match
             (error
-- 
2.47.2




More information about the sgo-software-discuss mailing list