Monthly Archives: October 2016
Remember to Delete the Root Password from Your History File
Ok, so you accidentally type in the root password before using su -.
Now you have to remember to delete it from your history file. This is somewhat non-obvious, because the history file is typically saved on successful exit.
So if you immediately do something like this.
$ tail -2 ~/.bash_history ssh somehost su -
There’s nothing suspicious in the history file.
So, log out, then log back in. Typically that means closing your ssh session, or terminal tab, and open a new session.
Now you see the password in the history file.
$ tail -2 ~/.bash_history su - ThisIsMyRootPassword
So fire up an editor and delete the line.
Building SBCL on OS X Yosemite
A month or two ago, it did not work to build Steel Banks Common Lisp on OS X Yosemite. Or at least it never worked for me.
This has been fixed now, at least as of recent git checkout, and quite possibly SBCL 1.3.10.
If you get an error like the following,
ld: library not found for -lgcc_s.10.4
then you can try this (as far as I know) totally undocumented switch
SBCL_MACOSX_VERSION_MIN=10.10 sh make.sh
and the build will succeed.
Happy lisping with SBCL!
When SBCL Is Buggy, and CFFI Is Undocumented
There are at least two good ways to create C strings (or alien strings) in Lisp. The most often used is CFFI‘s foreign-string-alloc and the other is SBCL‘s make-alien-string.
The SBCL routine make-alien-string is documented to return both the alien pointer and the length of the string. However, it doesn’t.
Today, I reported this bug so by the time you read this the following may actually work; but as of SBCL 1.3.9 it doesn’t.
(multiple-value-bind (buffer length) (make-alien-string "foo") (format t "buffer: ~a~%length: ~a~%" buffer length))
And this will print something like
buffer: #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X00400190 :TYPE (* (SB-ALIEN:SIGNED 8))> length: NIL
On the other hand, the CFFI routine foreign-string-alloc is not documented (as of this writing) to return an extra length value, but actually does.
(multiple-value-bind (buffer length) (cffi:foreign-string-alloc "foo") (format t "buffer: ~a~%length: ~a~%" buffer length))
Which will print something like
buffer: #.(SB-SYS:INT-SAP #X00600050) length: 4
Note that the result is by default zero terminated, and hence the four bytes.
Hopefully the CFFI documentation will be updated just as quickly as SBCL is patched.
Have fun, and enjoy the Lisp world because it’s full of weird stuff.