coleslaw-org / coleslaw

Flexible Lisp Blogware
BSD 2-Clause "Simplified" License
562 stars 82 forks source link

COLESLAW::URL unbound error #134

Closed jsjolen closed 7 years ago

jsjolen commented 7 years ago

When I do (coleslaw::main "my/project/path") the above error is signalled.

It is signalled by the static-page plugin when it loads my only defined page and it fails in the following function code:


(defmethod initialize-instance :after ((object page) &key)
  (with-slots (coleslaw::url coleslaw::text format) object
    (setf coleslaw::url (make-pathname :defaults coleslaw::url) <- error here
          format (alexandria:make-keyword (string-upcase format))
          coleslaw::text (render-text coleslaw::text format))))

Since coleslaw::url is unbound the MAKE-PATHNAME call will fail.

This is a minimal .page file for reproducing the bug:

;;;;;
title: 
tags: 
date: yyyy-mm-dd hh:mm:ss
format: md
;;;;;

And this is my .coleslawrc

(:author "Brit Butler"
 :deploy-dir "/home/git/blog/"
 :domain "http://blog.redlinernotes.com"
 :feeds ("lisp")
 :plugins ((analytics :tracking-code "foo")
           (disqus :shortname "my-site-name")
           ; (incremental)  ;; *Remove comment to enable incremental builds.
           (mathjax)
           (sitemap)
           (static-pages)
           ; (versioned)    ;; *Remove comment to enable symlinked, timestamped deploys.
          )
 :routing ((:post           "posts/~a")
           (:tag-index      "tag/~a")
           (:month-index    "date/~a")
           (:numeric-index  "~d")
           (:feed           "~a.xml")
           (:tag-feed       "tag/~a.xml"))
 :sitenav ((:url "http://redlinernotes.com/" :name "Home")
           (:url "http://twitter.com/redline6561" :name "Twitter")
           (:url "http://github.com/redline6561" :name "Code")
           (:url "http://soundcloud.com/redlinernotes" :name "Music")
           (:url "http://redlinernotes.com/docs/talks/" :name "Talks"))
 :staging-dir "/tmp/coleslaw/"
 :title "Improved Means for Achieving Deteriorated Ends"
 :theme "hyde")
jsjolen commented 7 years ago

Here's a paste of the entire stacktracea dn debug menu.

The slot COLESLAW::URL is unbound in the object
#<PAGE {10034937E3}>.
   [Condition of type UNBOUND-SLOT]

Restarts:
 0: [USE-VALUE] Return a value as the slot-value.
 1: [STORE-VALUE] Store and return a value as the slot-value.
 2: [RETRY] Retry SLIME REPL evaluation request.
 3: [*ABORT] Return to SLIME's top level.
 4: [ABORT] abort thread (#<THREAD "new-repl-thread" RUNNING {1008124E23}>)

Backtrace:
  0: ((:METHOD SLOT-UNBOUND (T T T)) #<unavailable argument> #<COLESLAW-STATIC-PAGES::PAGE {10034937E3}> COLESLAW::URL) [fast-method]
  1: (SB-PCL::SLOT-UNBOUND-INTERNAL #<COLESLAW-STATIC-PAGES::PAGE {10034937E3}> 0)
  2: ((:METHOD INITIALIZE-INSTANCE :AFTER (COLESLAW-STATIC-PAGES::PAGE)) #<COLESLAW-STATIC-PAGES::PAGE {10034937E3}>) [fast-method]
  3: ((SB-PCL::EMF INITIALIZE-INSTANCE) #<unused argument> #<unused argument> #<COLESLAW-STATIC-PAGES::PAGE {10034937E3}> :DATE "yyyy-mm-dd hh:mm:ss" :FORMAT "md" :TEXT "" :FILE "posts/main.page" :TAGS NIL..
  4: ((:METHOD MAKE-INSTANCE (CLASS)) #<STANDARD-CLASS COLESLAW-STATIC-PAGES::PAGE> #<unavailable &REST argument>) [fast-method]
  5: ((LAMBDA (COLESLAW::FILE) :IN COLESLAW:DISCOVER) #P"/home/johan/jak/posts/main.page")
  6: ((LABELS CL-FAD::WALK :IN CL-FAD:WALK-DIRECTORY) #P"/home/johan/jak/posts/")
  7: ((LABELS CL-FAD::WALK :IN CL-FAD:WALK-DIRECTORY) #P"/home/johan/jak/")
  8: (CL-FAD:WALK-DIRECTORY #P"/home/johan/jak/" #<CLOSURE (LAMBDA (COLESLAW::FILE) :IN COLESLAW:DISCOVER) {100347D6DB}> :DIRECTORIES NIL :IF-DOES-NOT-EXIST :ERROR :TEST #<CLOSURE (FLET #:EXTENSION-P6 :IN ..
  9: ((:METHOD COLESLAW:DISCOVER (T)) #<STANDARD-CLASS COLESLAW-STATIC-PAGES::PAGE>) [fast-method]
 10: ((SB-PCL::EMF COLESLAW:DISCOVER) #<unused argument> #<unused argument> #<STANDARD-CLASS COLESLAW-STATIC-PAGES::PAGE>)
 11: ((SB-PCL::GF-DISPATCH COLESLAW:DISCOVER) #<STANDARD-CLASS COLESLAW-STATIC-PAGES::PAGE>)
 12: (COLESLAW::LOAD-CONTENT)
 13: (COLESLAW:MAIN "/home/johan/jak/" NIL)
 14: (SB-INT:SIMPLE-EVAL-IN-LEXENV (COLESLAW:MAIN "/home/johan/jak/") #<NULL-LEXENV>)
 15: (EVAL (COLESLAW:MAIN "/home/johan/jak/"))
 16: (SWANK::EVAL-REGION "(coleslaw:main \"/home/johan/jak/\") ..)
 17: ((LAMBDA NIL :IN SWANK-REPL::REPL-EVAL))
 18: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::REPL-EVAL) {100854CAFB}>)
 19: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME REPL evaluation request." #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::REPL-EVAL) {100854CA5B}>)
 20: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::REPL-EVAL) {100854CA3B}>)
 21: (SWANK-REPL::REPL-EVAL "(coleslaw:main \"/home/johan/jak/\") ..)
 22: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(coleslaw:main \"/home/johan/jak/\") ..)
 23: (EVAL (SWANK-REPL:LISTENER-EVAL "(coleslaw:main \"/home/johan/jak/\") ..)
 24: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(coleslaw:main \"/home/johan/jak/\") ..)
 25: (SWANK::PROCESS-REQUESTS NIL)
 26: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 27: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 28: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {100815163B}>)
 29: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/home/johan/quicklisp/dists/quicklisp/software/slime-v2.18/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HA..
 30: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {10048557C3}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {1004927053}>) (*TRACE-OUTPUT* . #2#) (*ERR..
 31: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1003EC1383}> NIL)
 32: ((FLET #:WITHOUT-INTERRUPTS-BODY-1158 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 33: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 34: ((FLET #:WITHOUT-INTERRUPTS-BODY-359 :IN SB-THREAD::CALL-WITH-MUTEX))
 35: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {7FFFF483ED6B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THR..
 36: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "new-repl-thread" RUNNING {1008124E23}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::SPAWN-REPL-THREAD) {1008124DAB}> (#<SB-THREAD:THREAD..
 37: ("foreign function: call_into_lisp")
 38: ("foreign function: new_thread_trampoline")
jsjolen commented 7 years ago

url: must be provided as a header to a static-page's file. Also all headers must be non-empty.

EDIT: I will be supplying a pull request that informs the user of what is required of them as a more sensible error soon.