wanted: sbcl version assert

Bug #674372 reported by William Halliburton on 2010-11-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Several times in my working with other people, since I am keeping up
to date with SBCL, when I have them pull my latest code we go through
a cycle of:

them: "I'm getting error xyz."

me: "Oh, you need to update to the latest SBCL."

So I wrote the following in my initialization file. I'm wondering if
there is a place for this or something like it in the main code
base. If so, please review and I can clean it up as needed.

Also, if this launchpad system is not the best place for things like
this and the sbcl-devel list would be better, please inform me of my


(defparameter *required-sbcl-version* "")

(defun split-sbcl-version (str)
  (flet ((list-to-num (list)
           (parse-integer (coerce (nreverse list) 'string))))
    (loop with acc and vals
          for c across str
          do (if (digit-char-p c)
               (push c acc)
                 (push (list-to-num acc) vals)
                 (setf acc nil)))
          finally (return (cons (list-to-num acc) vals)))))

(defun sbcl-version-as-number (str)
  (destructuring-bind (d c b a) (split-sbcl-version str)
    (+ (* a 1000000000000)
       (* b 100000000)
       (* c 10000)

(let ((this-version (lisp-implementation-version)))
  (when (< (sbcl-version-as-number this-version)
           (sbcl-version-as-number *required-sbcl-version*))
    (format t "SBCL version of at least ~A is required. This SBCL is ~A.~%"
            *required-sbcl-version* this-version)

Nikodemus Siivola (nikodemus) wrote :

Launchpad is fine.

In principle I think SB-EXT:VERSION< or similar would be possible.

It does need to deal with non-numeric components, but probably TRT is the right thing to only parse the leading numeric components.


  (version< "" "") => T


  (version< "1.0.42.debian-something" "1.0.42.debian-something-other") => NIL

. Or possibly use STRING< to compare non-numeric tails. Dunno.

While there's no strict need to have this in SBCL itself, obviously, SBCL _is_ a sufficiently moving target that it might be a good thing.

Changed in sbcl:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: feature
removed: wishlist
summary: - wish for a sbcl version assert
+ wanted: sbcl version assert
tags: added: easy
Changed in sbcl:
importance: Wishlist → Low
Philip Munksgaard (pmunksgaard) wrote :

Wouldn't it make more sense to call it sb-ext:version<=, since i imagine we would want (version<= "1.0.42.debian-something" "1.0.42.debian-something") to return T?

Philip Munksgaard (pmunksgaard) wrote :

The attached patch adds SB-EXT:VERSION-ASSERT.

It takes a version number as a string, and asserts that (lisp-implementation-version) is equal to or greater than the given version.

I've chosen to only parse leading numerical components in the version strings and ignore anything after the numerical components stop. Trying to make sense of whether a bunch of letters are some kind of versioning scheme (1.1.12a vs. 1.1.12b), a designator for release candidates (1.1.12rc1), a specific git commit or branch (, distribution-specific (1.1.12-debian) is futile.

Thus, as soon as version-assert encounters a non-digit character that isn't a period in either the version-string or (lisp-implementation-version), it stops parsing any more. Beyond that it pretty much works as expected:

If the current version is 1.1.12, (version-assert "1.1.12") passes.
If the current version is 1.1.12, (version-assert "") does not pass.
If the current version is 1.1.1, (version-assert "1.0") passes.

tags: added: review
Changed in sbcl:
assignee: nobody → Philip Munksgaard (pmunksgaard)
status: Triaged → In Progress
Philip Munksgaard (pmunksgaard) wrote :

It seems that ASDF3 actually includes functions that do this:


Paul Khuong (pvk) wrote :

I pushed similar in 920b5eb (New function SB-EXT:ASSERT-VERSION->=). Thank you for the initial patch!

Changed in sbcl:
status: In Progress → Fix Committed
assignee: Philip Munksgaard (pmunksgaard) → nobody
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers