Changeset 15032


Ignore:
Timestamp:
06/01/17 06:46:20 (6 years ago)
Author:
Mark Evenson
Message:

Better directory validation; handle :UNSPECIFIC

(Olof-Joachim Frahm)

Location:
trunk/abcl
Files:
2 edited

Legend:

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

    r14987 r15032  
    791791        // is, both NIL and :UNSPECIFIC cause the component not to appear in
    792792        // the namestring." 19.2.2.2.3.1
    793         if (directory != NIL) {
     793        if (directory != NIL && directory != Keyword.UNSPECIFIC) {
    794794            final char separatorChar = '/';
    795795            LispObject temp = directory;
     
    820820                } else if (part == Keyword.UP) {
    821821                    sb.append("..");
    822                 } else {
    823                     error(new FileError("Unsupported directory component " + part.princToString() + ".",
    824                       this));
    825822                }
    826823                sb.append(separatorChar);
     
    14811478       
    14821479        p.version = version;
     1480        p.validateDirectory(true);
    14831481        return p;
    14841482    }
     
    15021500    private final boolean validateDirectory(boolean signalError) {
    15031501        LispObject temp = directory;
     1502        if (temp == Keyword.UNSPECIFIC) {
     1503            return true;
     1504        }
    15041505        while (temp != NIL) {
    15051506            LispObject first = temp.car();
     
    15181519                    return false;
    15191520                }
     1521            } else if (first != Keyword.RELATIVE
     1522                       && first != Keyword.WILD
     1523                       && first != Keyword.UP
     1524                       && first != Keyword.BACK
     1525                       && !(first instanceof AbstractString)) {
     1526                if (signalError) {
     1527                    error(new FileError("Unsupported directory component " + first.princToString() + ".",
     1528                      this));
     1529                }
     1530                return false;
    15201531            }
    15211532        }
  • trunk/abcl/test/lisp/abcl/pathname-tests.lisp

    r14247 r15032  
    17231723  :wild :wild :wild (:absolute :wild))
    17241724     
     1725
     1726(deftest pathname.make-pathname.3
     1727    (signals-error
     1728     (make-pathname :directory '(:absolute ("a" "b")))
     1729     'file-error)
     1730  t)
     1731
     1732(deftest pathname.make-pathname.4
     1733    (directory-namestring (make-pathname :directory :unspecific))
     1734  "")
Note: See TracChangeset for help on using the changeset viewer.