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

Bug #1739906 reported by Richard M Kreuter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Low
Unassigned

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 ./run-sbcl.sh --no-userinit --no-sysinit
(running SBCL from: .)
This is SBCL 1.4.2.276-0288458, 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-directory "/AB/cd/" :case :common)

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

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

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

#P"/Ab/CD/ef/"
--

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

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

(:ABSOLUTE #<SB-IMPL::PATTERN "a" :MULTI-CHAR-WILD "b">)
* (make-pathname :case :common :directory (pathname-directory "/a*b/" :case :common))

#P"/A*B/"
--

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*

(:64-BIT :64-BIT-REGISTERS :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :BSD
 :C-STACK-IS-CONTROL-STACK :COMMON-LISP :COMPACT-INSTANCE-HEADER
 :COMPARE-AND-SWAP-VOPS :COMPLEX-FLOAT-VOPS :CYCLE-COUNTER :DARWIN
 :DARWIN9-OR-BETTER :FLOAT-EQL-VOPS :FP-AND-PC-STANDARD-SAVE :GENCGC
 :IEEE-FLOATING-POINT :IMMOBILE-CODE :IMMOBILE-SPACE :INLINE-CONSTANTS :INODE64
 :INTEGER-EQL-VOP :LINKAGE-TABLE :LITTLE-ENDIAN :MACH-EXCEPTION-HANDLER :MACH-O
 :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS :OS-PROVIDES-BLKSIZE-T
 :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN :OS-PROVIDES-PUTWC
 :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES :PRECISE-ARG-COUNT-ERROR
 :RAW-INSTANCE-INIT-VOPS :RAW-SIGNED-WORD :RELOCATABLE-HEAP :SB-DOC :SB-EVAL
 :SB-LDB :SB-PACKAGE-LOCKS :SB-SIMD-PACK :SB-SOURCE-LOCATIONS :SB-THREAD
 :SB-UNICODE :SBCL :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS :UD2-BREAKPOINTS
 :UNBIND-N-VOP :UNDEFINED-FUN-RESTARTS :UNIX :UNWIND-TO-FRAME-AND-CALL-VOP
 :X86-64)

--

Revision history for this message
Richard M Kreuter (kreuter) wrote :
Jan Moringen (scymtym)
Changed in sbcl:
assignee: nobody → Jan Moringen (scymtym)
importance: Undecided → Low
status: New → Confirmed
Jan Moringen (scymtym)
Changed in sbcl:
status: Confirmed → Fix Committed
assignee: Jan Moringen (scymtym) → nobody
Revision history for this message
Richard M Kreuter (kreuter) wrote :

Whoops, this proves to be a duplicate of https://bugs.launchpad.net/sbcl/+bug/695486

Sorry for the noise.

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.