From 2a713d7386f59da8e87095ea4eabfc522b13a3a2 Mon Sep 17 00:00:00 2001 From: Glenn Thompson Date: Sun, 8 Mar 2026 22:02:46 +0300 Subject: [PATCH] Fix SBCL bracket-escaping in shuffle library scanner stream-harmony.lisp: - scan-music-library-files: use native-namestring instead of namestring when collecting file paths, producing real OS paths without SBCL's backslash escaping of brackets (e.g. [FLAC] not \[FLAC]) - Use parse-native-namestring for root directory entry point so dirs with brackets are not treated as wildcard patterns cl-streamer submodule updated to d57a268: - play-file, read-audio-metadata, play-list retry: same native-namestring fix to prevent double-escaping through parse-native-namestring Fixes FLAC FILE slot unbound errors and SIGSEGV memory fault that crashed the shuffle pipeline after consecutive failures on bracket paths. --- cl-streamer | 2 +- stream-harmony.lisp | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cl-streamer b/cl-streamer index c0f9c0e..d57a268 160000 --- a/cl-streamer +++ b/cl-streamer @@ -1 +1 @@ -Subproject commit c0f9c0e161e2076f7dde8fdcbcb0f701d02cc35b +Subproject commit d57a2683e757577a7292b63b5d3ad7016bb24187 diff --git a/stream-harmony.lisp b/stream-harmony.lisp index e92b677..b8b2fa6 100644 --- a/stream-harmony.lisp +++ b/stream-harmony.lisp @@ -307,7 +307,8 @@ (defun scan-music-library-files (&optional (directory *music-library-path*)) "Recursively scan DIRECTORY for supported audio files. - Returns a list of namestrings." + Returns a list of native namestrings (real OS paths without SBCL's + bracket escaping, safe to pass through parse-native-namestring later)." (let ((files nil) (extensions *supported-formats*)) (labels ((scan (dir) @@ -315,7 +316,7 @@ (dolist (entry (uiop:directory-files dir)) (let ((ext (pathname-type entry))) (when (and ext (member ext extensions :test #'string-equal)) - (push (namestring entry) files)))) + (push (sb-ext:native-namestring entry) files)))) (error (e) (log:debug "Error scanning ~A: ~A" dir e))) (handler-case @@ -323,7 +324,14 @@ (scan sub)) (error (e) (log:debug "Error listing subdirs of ~A: ~A" dir e))))) - (scan (pathname directory))) + ;; Use parse-native-namestring so directories with brackets (e.g. + ;; "[FLAC]") are not treated as wildcard patterns by SBCL. + (scan (sb-ext:parse-native-namestring + (etypecase directory + (string directory) + (pathname (sb-ext:native-namestring directory))) + nil *default-pathname-defaults* + :as-directory t))) (nreverse files))) (defvar *shuffle-library-cache* nil