Unparsing pattern components doesn't escape special characters

Bug #1738803 reported by Richard M Kreuter on 2017-12-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

Producing a namestring for a Unix pathname with an SB-IMPL::PATTERN component doesn't escape any characters in the pattern. As all characters inside a PATTERN are literals, if the pattern contains any characters with special syntax, the namestring doesn't parse back to the right pathname.

--
$ sh run-sbcl.sh --no-userinit --no-sysinit
(running SBCL from: .)
This is SBCL 1.3.2.69-aff4a0f, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (pathname-name "*\\*")

#<SB-IMPL::PATTERN :MULTI-CHAR-WILD "*">
* (namestring (pathname "*\\*"))

"**"
* (equal (pathname "*\\*") (parse-namestring (namestring (pathname "*\\*"))))

NIL
--

By inspection, CMUCL evinces the same behavior, so this might have be around "forever" (but I haven't checked).

The attached patch fixes this bug.

This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers