Commit 7681280e authored by Mark's avatar Mark
Browse files

Address inconsistency between populating entries in JAR-PATHNAME

A DIRECTORY should always be :ABSOLUTE in a JAR-PATHNAME unless there
is no name or type component.

Currently a problem with loading ASDF systems from jars, as

     (UIOP/PATHNAME:PARSE-UNIX-NAMESTRING "quicklisp-abcl"
                                          :WANT-RELATIVE T :TYPE "lisp"
                                          :DEFAULTS #P"jar:file:///Users/evenson/work/abcl/dist/abcl-contrib.jar!/quicklisp/")

fails.

Why is WANT-RELATIVE doing this with a absolute default?
parent 2d06d0c3
......@@ -84,6 +84,26 @@ public class JarPathname
return result;
}
/** Transform a reference to a nested Jar to an entry */
public static JarPathname archiveAsEntry(JarPathname p) {
JarPathname result = new JarPathname();
result = (JarPathname)result.copyFrom(p);
LispObject jars = result.getJars();
jars = jars.nreverse();
Pathname entry = (Pathname)jars.car();
jars = jars.cdr().nreverse();
result
.setDevice(jars)
.setDirectory(entry.getDirectory())
.setName(entry.getName())
.setType(entry.getType());
return result;
}
/** Transform an entry in a jar to a reference as a jar */
public static JarPathname createFromEntry(JarPathname p) {
JarPathname result = new JarPathname();
......
......@@ -1293,8 +1293,14 @@ public class Pathname extends LispObject
rootDevice = URLPathname.create(root);
}
result.setDevice(new Cons(rootDevice, result.getDevice().cdr()));
// sanity check that the pathname has been constructed correctly
if (result.getDirectory().equals(NIL)
&& (!result.getName().equals(NIL)
|| !result.getType().equals(NIL))) {
result.setDirectory(NIL.push(Keyword.ABSOLUTE));
}
// sanity check that the pathname has been constructed correctly
result.validateComponents();
return result;
}
......@@ -1793,6 +1799,15 @@ public class Pathname extends LispObject
} else {
result.setType(d.getType());
}
// JAR-PATHNAME directories are always absolute
if ((result instanceof JarPathname)
&& (!result.getName().equals(NIL)
|| !result.getType().equals(NIL))
&& result.getDirectory().equals(NIL)) {
result.setDirectory(NIL.push(Keyword.ABSOLUTE));
}
// CLtLv2 MERGE-PATHNAMES
// "[T]he missing components in the given pathname are filled
......
......@@ -507,36 +507,27 @@ public class ZipCache {
}
static ArchiveStream getArchiveStreamFromFile(JarPathname p) {
JarPathname root = new JarPathname();
root.setDevice(new Cons(p.getRootJar(), NIL));
Pathname nextJar = (Pathname)p.getJars().cdr().car();
ArchiveFile rootArchiveFile = (ArchiveFile)getArchiveFile(root);
JarPathname innerArchive = new JarPathname();
LispObject jars = list(p.getRootJar(), nextJar);
innerArchive.setDevice(jars);
JarPathname innerArchiveAsEntry = new JarPathname();
innerArchiveAsEntry
.setDevice(new Cons(root, NIL))
.setDirectory(nextJar.getDirectory())
.setName(nextJar.getName())
.setType(nextJar.getType());
ZipEntry entry = rootArchiveFile.getEntry(innerArchiveAsEntry);
if (entry == null) {
return null;
}
InputStream inputStream = rootArchiveFile.getEntryAsInputStream(innerArchiveAsEntry);
if (inputStream == null) {
return null;
}
ArchiveStream result = new ArchiveStream(inputStream, innerArchive, entry);
return result;
}
JarPathname innerArchiveAsEntry = JarPathname.archiveAsEntry(p);
JarPathname root = new JarPathname();
root = (JarPathname)root.copyFrom(innerArchiveAsEntry);
root
.setDirectory(NIL)
.setName(NIL)
.setType(NIL)
.setVersion(Keyword.NEWEST);
ArchiveFile rootArchiveFile = (ArchiveFile)getArchiveFile(root);
ZipEntry entry = rootArchiveFile.getEntry(innerArchiveAsEntry);
if (entry == null) {
return null;
}
InputStream inputStream = rootArchiveFile.getEntryAsInputStream(innerArchiveAsEntry);
if (inputStream == null) {
return null;
}
ArchiveStream result = new ArchiveStream(inputStream, p, entry);
return result;
}
public static Archive getArchiveURL(JarPathname jar) {
Pathname rootJar = (Pathname) jar.getRootJar();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment