Changeset 15492


Ignore:
Timestamp:
11/30/20 08:22:35 (2 years ago)
Author:
Mark Evenson
Message:

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?

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/JarPathname.java

    r15490 r15492  
    8585  }
    8686
     87  /** Transform a reference to a nested Jar to an entry */
     88  public static JarPathname archiveAsEntry(JarPathname p) {
     89    JarPathname result = new JarPathname();
     90    result = (JarPathname)result.copyFrom(p);
     91
     92    LispObject jars = result.getJars();
     93    jars = jars.nreverse();
     94    Pathname entry = (Pathname)jars.car();
     95    jars = jars.cdr().nreverse();
     96
     97    result
     98      .setDevice(jars)
     99      .setDirectory(entry.getDirectory())
     100      .setName(entry.getName())
     101      .setType(entry.getType());
     102   
     103    return result;
     104  }
     105   
     106
    87107  /** Transform an entry in a jar to a reference as a jar */
    88108  public static JarPathname createFromEntry(JarPathname p) {
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r15457 r15492  
    12941294          }
    12951295          result.setDevice(new Cons(rootDevice, result.getDevice().cdr()));
     1296
     1297          if (result.getDirectory().equals(NIL)
     1298              && (!result.getName().equals(NIL)
     1299                  || !result.getType().equals(NIL))) {
     1300            result.setDirectory(NIL.push(Keyword.ABSOLUTE));
     1301          }
     1302
    12961303          // sanity check that the pathname has been constructed correctly
    1297 
    12981304          result.validateComponents();
    12991305          return result;
     
    17941800        result.setType(d.getType());
    17951801      }
     1802
     1803      // JAR-PATHNAME directories are always absolute
     1804      if ((result instanceof JarPathname)
     1805          && (!result.getName().equals(NIL)
     1806              || !result.getType().equals(NIL))
     1807          && result.getDirectory().equals(NIL)) {
     1808        result.setDirectory(NIL.push(Keyword.ABSOLUTE));
     1809      }
     1810           
    17961811      //  CLtLv2 MERGE-PATHNAMES
    17971812   
  • trunk/abcl/src/org/armedbear/lisp/ZipCache.java

    r15491 r15492  
    508508
    509509  static ArchiveStream getArchiveStreamFromFile(JarPathname p) {
    510       JarPathname root = new JarPathname();
    511       root.setDevice(new Cons(p.getRootJar(), NIL));
    512       Pathname nextJar = (Pathname)p.getJars().cdr().car();     
    513       ArchiveFile rootArchiveFile = (ArchiveFile)getArchiveFile(root);
    514 
    515       JarPathname innerArchive = new JarPathname();
    516 
    517       LispObject jars = list(p.getRootJar(), nextJar);
    518       innerArchive.setDevice(jars);
    519 
    520       JarPathname innerArchiveAsEntry = new JarPathname();
    521       innerArchiveAsEntry
    522         .setDevice(new Cons(root, NIL))
    523         .setDirectory(nextJar.getDirectory())
    524         .setName(nextJar.getName())
    525         .setType(nextJar.getType());
    526 
    527       ZipEntry entry = rootArchiveFile.getEntry(innerArchiveAsEntry);
    528       if (entry == null) {
    529         return null;
    530       }
    531       InputStream inputStream = rootArchiveFile.getEntryAsInputStream(innerArchiveAsEntry);
    532       if (inputStream == null) {
    533         return null;
    534       }
    535       ArchiveStream result = new ArchiveStream(inputStream, innerArchive, entry);
    536       return result;
    537   }
     510        JarPathname innerArchiveAsEntry = JarPathname.archiveAsEntry(p);
     511    JarPathname root = new JarPathname();
     512    root = (JarPathname)root.copyFrom(innerArchiveAsEntry);
     513    root
     514      .setDirectory(NIL)
     515      .setName(NIL)
     516      .setType(NIL)
     517      .setVersion(Keyword.NEWEST);
    538518   
    539  
     519    ArchiveFile rootArchiveFile = (ArchiveFile)getArchiveFile(root);
     520    ZipEntry entry = rootArchiveFile.getEntry(innerArchiveAsEntry);
     521    if (entry == null) {
     522      return null;
     523    }
     524    InputStream inputStream = rootArchiveFile.getEntryAsInputStream(innerArchiveAsEntry);
     525    if (inputStream == null) {
     526      return null;
     527    }
     528    ArchiveStream result = new ArchiveStream(inputStream, p, entry);
     529    return result;
     530  }
    540531
    541532  public static Archive getArchiveURL(JarPathname jar) {
Note: See TracChangeset for help on using the changeset viewer.