1# ISSUE MERGE-PATHNAMES with specialization of JAR-PATHNAME 2 3We wish to resolve the following issues. 4 5## UC0 Loading jna.jar for CFFI via Quicklisp 6 7Currently we cannount load systems via ASDF recursively in jars, most 8importantly for those packaged in 'abcl-contrib.jar', which prevents 9CFFI from loading the necessary JNA code. 10 11## UC1.1 12If *DEFAULT-PATHNAME-DEFAULTS* is a JAR-PATHNAME, commands that would 13normally be expected to work such as 14 15 CL-USER> (probe-file #p"/") 16 17will fail. 18 19### UC1.2 20 21If *DEFAULT-PATHNAME-DEFAULTS* is a JAR-PATHNAME, COMPILE-FILE 22operations specifying an OUTPUT-FILE with a NIL DEVICE will fail, as 23COMPILE-FILE-PATHNAME is required to merge its arguments with the 24defaults. 25 26## CLHS Citations 27 28Some especially relevant portions of the CLHS for consideration. 29 30### 19.2.3 Merging Pathnames 31http://www.lispworks.com/documentation/HyperSpec/Body/19_bc.htm 32 33"Except as explicitly specified otherwise, for functions that 34manipulate or inquire about files in the file system, the pathname 35argument to such a function is merged with *default-pathname-defaults* 36before accessing the file system (as if by merge-pathnames)." 37 38Note that this implies that the arguments to PARSE-NAMESTRING--which 39is what the SHARSIGN-P reader macro correpsponds to--should not be 40merged. 41 42 43## 19.2.2.2.3 :UNSPECIFIC as a Component Value 44http://www.lispworks.com/documentation/HyperSpec/Body/19_bbbc.htm 45 46"If :unspecific is the value of a pathname component, the component is 47considered to be ``absent'' or to ``have no meaning'' in the filename 48being represented by the pathname." 49 50Having an :UNSPECIFIC DEVICE when a PATHNAME refers to a file would 51address problems when merging when the defaults contains a JAR-PATHNAME. 52 53### MERGE-PATHNAMES 54http://www.lispworks.com/documentation/HyperSpec/Body/f_merge_.htm 55 56"If pathname explicitly specifies a host and not a device, and if the 57host component of default-pathname matches the host component of 58pathname, then the device is taken from the default-pathname; 59otherwise the device will be the default file device for that host. If 60pathname does not specify a host, device, directory, name, or type, 61each such component is copied from default-pathname." 62 63This suggests that the contents HOST should be considered as an 64additional axis of type for PATHNAME, so that when PATHNAMES of 65differing types get merged, a DEVICE which has no meaning for a given 66type does not get inserted. 67 68## Other implementations 69 70A survey of the the "default" host for #p"/" on startup. 71 72### SBCL 73 74A host nonce which appears in the reader as 75#<SB-IMPL::UNIX-HOST {1000290443}>. (Is there a different one under 76Windows?) 77 78### CLISP 79 80HOST is NIL. 81 82### CCL 83 84HOST is :UNSPECIFIC. 85 86### ECL 87 88HOST is NIL. 89 90## Implementation 91 92Since Windows systems do have a default DEVICE for a normal file 93PATHNAME, namely the current "drive letter" of the process, the 94implementation changes will be mostly wrapped in runtime conditionals 95for non-Windows systems. 96 97### TRUENAME sets DEVICE to :UNSPECIFIC 98 99TRUENAME sets DEVICE to :UNSPECIFIC running on non-Windows when 100resolving a path to a plain file. 101 102 103### DIRECTORY sets DEVICE to :UNSPECIFIC 104 105When the default for the :RESOLVE-SYMLINKS argument to DIRECTORY was 106changed to nil, DIRECTORY was changed not to always resolve its 107results via TRUENAME. As a result 108 109 (equal (truename "~/.emacs") 110 (first (directory "~/.emacs")) ) 111 112forms would return nil. This is a bit counter to expectations set by 113CLHS that DIRECTORY "returns a list of pathnames corresponding to the 114truenames". In particular, this breaks the ANSI CL DIRECTORY.[67] 115tests. Thus, under non-Windows we now explicitly normalize DEVICE 116components which are nil to :UNSPECIFIC for the results of DIRECTORY 117calls. 118 119### Use an implicit type for merging 120 121In the case for which a merge occurs when DEFAULT-PATHNAME 122is a JAR-PATHNAME and the following conditions hold: 123 124 1. HOST and DEVICE of the PATHNAME are NIL 125 126 2. The DIRECTORY of the PATHNAME represents an absolute path. 127 128 3. We are not running under Windows. 129 130we set the DEVICE to be :UNSPECIFIC. 131 132### COLOPHON 133 134Mark <evenson@panix.com> 135Created: 01-SEP-2012 136Revised: 06-FEB-2014 137 138