Defective case diddling in PATHNAME-DIRECTORY breaks round-tripping.

Bug #1739906 reported by Richard M Kreuter on 2017-12-23
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Defective case diddling in PATHNAME-DIRECTORY breaks round-tripping.

Two problems in SB-IMPL::MAYBE-DIDDLE-CASE's recursion break round-tripping values obtained from a directory when using :COMMON case:

1. PATHNAME-DIRECTORY with case :COMMON does not convert lettercase when there is any lettercase variation in all characters in the directory, but MAKE-PATHNAME with case :COMMON handles the lettercase of each directory element individually:

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

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-directory "/AB/cd/" :case :common)

(:ABSOLUTE "AB" "cd")
* (make-pathname :case :common :directory (pathname-directory "/AB/cd/" :case :common))

* (pathname-directory #P"/Ab/cd/EF/" :case :common)

(:ABSOLUTE "Ab" "cd" "EF")
* (make-pathname :directory (pathname-directory "/Ab/cd/EF/" :case :common) :case :common)


2. PATHNAME-DIRECTORY doesn't diddle lettercase inside SB-IMPL::PATTERN instances, but MAKE-PATHNAME does:

* (pathname-directory "/a*b/" :case :common)

* (make-pathname :case :common :directory (pathname-directory "/a*b/" :case :common))


In the above scenarios, I expected round-tripping when using the same values for CASE.

ANSI is ambiguous-by-omission on the details here, but I'd say that PATHNAME-DIRECTORY, and not MAKE-PATHNAME, is the one with the defect, because having PATHNAME-DIRECTORY convert lettercase element-by-element and inside PATTERN instances makes each element of the returned list denote suitably when supplied as other pathname fields to the constructor with :COMMON case, i.e., you can use elements of the list in functions like

(lambda (x) (make-pathname :case :common :name x))

and have a consistent denotation.

The attached patch changes changes SB-IMPL::MAYBE-DIDDLE-CASE to achieve the desired effect.

Other requested info:

* $ uname -a
Darwin m5.localdomain 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64

* *features*



Richard M Kreuter (kreuter) wrote :
Jan Moringen (scymtym) on 2017-12-27
Changed in sbcl:
assignee: nobody → Jan Moringen (scymtym)
importance: Undecided → Low
status: New → Confirmed
Jan Moringen (scymtym) on 2017-12-29
Changed in sbcl:
status: Confirmed → Fix Committed
assignee: Jan Moringen (scymtym) → nobody
Richard M Kreuter (kreuter) wrote :

Whoops, this proves to be a duplicate of

Sorry for the noise.

Jan Moringen (scymtym) wrote :

in 1af24465b37ab8ca3dee3f029a16b84092e0ffa0

Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers