Subscribe

Desire status, struggling creative misuses of ASDF files

These days desire is less reliable in determining dependencies, than it used to be.

The apparent reason is that, by now, people have seemingly increased their use of funny stuff within .asd files.

Let me explain.

This is a long struggle, but the gist of it, is that given an .asd filename, I need to determine what systems it defines (declares?).

The only way to avoid getting false positives, is to parse them manually, because people tend to do things like:

(eval-when (:load-toplevel :compile-toplevel)
  (asdf:oos 'asdf:load-op :somesystem))

Note, how I use "parse" and "manually" in the same phrase.

The sad state of affairs, is that it is impossible to read a Common Lisp form, using standard high-level reader facilities of Common Lisp, in the general case.

While this sounds inflammatory, it merely refers to the fact, that forms, referring to symbols in unknown packages, have no defined representation in CL, or even a way to handle them, barring an IGNORE-ERRORS around READ.

And yes, such forms are aplenty within all sorts of .asd files. Actually, their use has increased, during the last year and a half.

But, there is light on the horison – thankfully Pascal Bourgignon have implemented a hookable Common Lisp reader:

http://git.informatimago.com/viewgit/?a=tree&p=public/lisp&h=fc21bf13409c2cf35044828604ebcd8d1ac91693&hb=9c2f2a59c0171d2b307d0682a064776e5f6906b6&f=common-lisp/lisp-reader

Setting up a Common Lisp environment on Meego using Desire (in Virtualbox)

Getting and installing Meego

In this tutorial, we're working with Meego 1.1, which can be obtained from:

http://repo.meego.com/MeeGo/releases/1.1/netbook/images/meego-netbook-ia32/meego-netbook-ia32-1.1.img

The version of Virtualbox I have succeeded with is 4.0.

For some reason I couldn't get any other combination of versions of Meego and Virtualbox to work. Maybe I was doing something wrong. This setup, however, was tested twice.

The instructions below were derived from those written by Feng Haitao:

http://wiki.meego.com/MeeGo_1.0_Netbook_VirtualBox

So, save the image with an .iso extension, and then:

  1. set up a 32bit "Linux 2.6" VM, with PAE, VT, nested paging, but without 3D acceleration,
  2. proceed with installation,
  3. reboot, as requested,
  4. continue with installation, right until you hit a black screen,
  5. reset the VM (this is the only time you'll need to be this harsh), but before that..
  6. prepare to strike 'Esc' once, right before the boot begins;
    • if you succeed, you'll get into the GRUB menu, good,
    • if you fail, you'll boot, but Meego will stall, because of a lack of 3D acceleration, try again, but reboot using ACPI shutdown-poweron cycle – you need your filesystem intact,
  7. in GRUB menu, strike 'Tab', remove 'quiet' option, add 's' option, strike 'Enter' to boot, you're in the single-user mode,
  8. execute:
    dhclient eth0
    
  9. set up the 'httpproxy' variable, if appropriate,
  10. execute:
    zypper install make gcc patch kernel-netbook-devel
    
  11. reboot carefully:
    init 6
    
  12. repeat steps 6, 7
  13. download the guest additions from:
    http://download.virtualbox.org/virtualbox/4.0.0/VBoxGuestAdditions_4.0.0.iso
    
  14. insert the image, and execute:
    mount /dev/sr0 /mnt
    cd /mnt
    sh VBoxLinuxAdditions.run
    
  15. turn off the VM:
    shutdown -h now
    
  16. enable 3D acceleration.

After that, you should have a somewhat usable (you'll experience graphical glitches) Meego 1.1 install.

Should te graphic glitches prove tiresome, replace the 'quiet' option in

/boot/extlinux/extlinux.conf

with '3' (boot into multi-user text mode).

Obtaining and building SBCL

Get SBCL from:

http://downloads.sourceforge.net/project/sbcl/sbcl/1.0.45/sbcl-1.0.45-x86-linux-binary.tar.bz2

Run the 'Terminal' application and type:

cd Downloads
tar xf sbcl-1.0.45-x86-linux-binary.tar.bz2
cd sbcl-1.0.45-x86-linux
sudo su
INSTALL_ROOT=/usr/local sh install.sh
exit
cd

Now, you've got working SBCL:

[user-desktop ~]$ sbcl --version
SBCL 1.0.45

Bootstrapping desire

Install git:

sudo zypper install git

Download the desire bootstrap script, climb.sh, from:

http://www.feelingofgreen.ru/shared/src/desire/climb.sh

Optionally, if you lack direct internet access, set the proxy:

export http_proxy=http://proxy:port/

Bootstrap desire:

sh climb.sh ~/desr

This should get you to this prompt:

 Congratulations! You have reached a point where you can wish for any package
 desire knows about. Just type (lust 'desiree) and it will happen.
 You can link desire's pool of packages into ASDF by ensuring that
 #p"/home/user/desr/.asdf-registry/" is in your ASDF:*CENTRAL-REGISTRY*

 To see what's possible, issue:
   (apropos-desr 'clim)
 or
   (list-modules)

 Have fun!

 *

My year in Lisp

Following the trend, and my not having a Reddit account, there goes:

  • I have convinced my employer, at the time, to release common-db, an extensible debugger substrate – my labour of several years, under GPL; I guess this was the main achievement of the year;
  • during the work on the above, I have cooperated with Julian Stecklina, while extending gdb-remote;
  • I have begun porting desire to Lisps other than SBCL, but the low-level details and missing functionalities, eventually, took the best part of me, only allowing me to add Clozure CL to the list of supported implementations; at some point, due to several persons' nudging, I've restarted doing work on desire, yet only to cease it soon after, because…
  • I've had a drastic turn in my life, caused by my new employer; I'm now under a much tighter schedule, with almost no free time and weekends busy recuperating. The new job is exciting, and I've got to do quite a bit of Lisp there, for which I'm immensely thankful. My first job was to translate a large body of code from one programming language to another, and Common Lisp was a perfect fit for that. I need to reach some balance, though, because I don't feel I can spend much more time without open-source hacking : -)
  • while working on the above, I've had a chance to slightly extend the ometa2 parser, adding source location and debugging support; the results can be grabbed from:
    git://git.feelingofgreen.ru/ometa2
    
  • sometime about mid-year, I've set up a plausibly-looking VM farm, for desire purposes, with a meaningful variety of operating systems, each containing all Lisp implementations I could get running; the biggest chunk of time went towards setting up unified SSH access, providing for automated installation of said Lisp implementations; the end result looks almost useful.
  • I have sent Juan, the maintainer of the venerable ECL, a couple of patches, as a token of gratitude for his excellent work, enabling me to use Common Lisp in an unlikely and hostile environment.

I guess, that was it.

Obtaining, building and setting up NoMachine's MinGW port of OpenSSH's SSHD

First of all, you'll need a working MinGW setup. Today, it means downloading and running the installer of the awesome mingw-get:

http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20100909/mingw-get-inst-20100909.exe/download

Follow all the defaults. After you go through the installer, create a shortcut to MinGW/msys/1.0/msys.bat shell startup script for your convenience. After that, launch this shell, and execute:

sh /postinstall/pi.sh

Next, you need msysgit, to obtain the bleeding-edge, patched version of openssh. Get it from:

https://code.google.com/p/msysgit/

Finally, the last auxiliary step you'll have to perform, is to set up %Path% to include the path to the git binary for MinGW. To do this, just copy the piece of %Path% added by the msysgit installer, and change the last component in the copy from 'cmd' to 'bin'.

Now, on to building stuff. Launch the MinGW shell, and execute:

mingw-get install mingw-developer-toolkit msys-zlib-dev

which will download and install the MinGW DTK and zlib headers.

Next, download OpenSSL, and build it:

curl http://openssl.org/source/openssl-1.0.0a.tar.gz | tar xz
cd openssl-1.0.0a
./Configure --prefix=/mingw mingw no-capieng
make depend all install

Finally, obtain NoMachine's openssh sources with my 'secret sauce' patches:

git clone git://git.feelingofgreen.ru/openssh

Then configure and build it:

cd openssh
export CPPFLAGS="-I/include -I$(PWD)/openbsd-compat -I$(PWD)/contrib/win32/win32compat/includes"
export LDFLAGS="-L/lib"
autoreconf
(
cat <<EOF
0000000: 3a31 3532 3933 0d61 7472 7565 1b3a 7771  :15293.atrue.:wq
0000010: 0d                                       .
EOF
) | xxd -r > configure-fixup.vim
vim -s configure-fixup.vim configure
./configure --prefix=/
cat config.h.tail >> config.h
make ssh.exe sshd.exe

Finally, before installing it, edit sshdconfig, find the "UsePrivilegeSeparation" commented out option, uncomment it and change it to "no".

Now, copy things to their destination:

cp sshd.exe /bin
cp sshd_config /etc/ssh
cp /mingw/bin/libssp-0.dll /etc/ssh

You need to produce host keys somehow, and put them into /etc/ssh.

At this point you already can run sshd in the foreground, like this:

cd /etc/ssh
/bin/sshd -r

However, I presume you'd rather install it as a windows service. To do this, you'll first need to install the Windows Resource Kit. Get it from:

https://www.microsoft.com/downloads/en/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

We'll need just three executables out of the whole thing:

  • instsrv.exe
  • ntrights.exe
  • srvany.exe

Copy them into MinGW's /bin.

Now, you have to choose an account in the 'Administrators' group. For the sake of simplicity, let's call it "user". Now execute:

reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\sshd\\Parameters //f //v Application   //t REG_SZ //d c:\\mingw\\msys\\1.0\\bin\\sshd.exe
reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\sshd\\Parameters //f //v AppDirectory  //t REG_SZ //d c:\\mingw\\msys\\1.0\\etc\\ssh
reg add HKLM\\SYSTEM\\CurrentControlSet\\Services\\sshd\\Parameters //f //v AppParameters //t REG_SZ //d "-r -M"
ntrights -u user +r SeLockMemoryPrivilege
ntrights -u user +r SeCreateTokenPrivilege
ntrights -u user +r SeAssignPrimaryTokenPrivilege
ntrights -u user +r SeServiceLogonRight
ntrights -u user +r SeIncreaseQuotaPrivilege
ntrights -u user +r SeTcbPrivilege
ntrights -u user +r SeImpersonatePrivilege
instsrv sshd c:\\mingw\\msys\\1.0\\bin\\srvany.exe

…while being mindful about your real MinGW install path.

Then, run msconfig, open the "Services" pane, find the "sshd" service, and make it run as "user" (don't forget to enter the password), not as "Local System".

Finally, ensure that the port 22 is open to outside connections in the Windows Firewall – add a simple inbound rule for that port (not an application!).

Having gone through all this, sshd can now be started like this:

sc start sshd

How to blog, reminder to self

I've spent quite some time re-figuring the magic Emacs keystroke to get my orgmode+jekyll setup to allow me to write some blog entries. The key was to remember that it used org-remember for templates. Some googling, and, la voila, the keystroke is 'C-c r'.

I guess my excuse is that the last time I used it was end of January..