I'm using sb-ext:run-process to read the list of installed files from
a .deb (using dpkg-query) as part of a larger program, but I'm getting
peculiar results from my code. I've chopped out an illustrative chunk:
If that is saved to e.g. "run-process-test.lisp" and executed with
"sbcl --load run-process-test.lisp --eval '(execute-test)' ubuntu-mono"
it prints the sbcl banner and then appears to hang. "ps x" shows a
dpkg-query process doing nothing. If that dpkg-query process is killed
then the script will complete, it prints a list of 975 files (and the
count) and starts the REPL.
However if I run "dpkg-query --listfiles ubuntu-mono" there are extra
entries (compared to what I get from sbcl), and indeed, with
"dpkg-query --listfiles ubuntu-mono | wc -l" I get 1672, not 975.
This difference is consistent between executions, and sbcl-1.0.40 (base
ubuntu maverick) and 18.104.22.168 (from cvs), but it varies by package e.g.
for the package ubuntu-docs I consistently get 1584 and not 4967.
The paste has 2 versions of read-package-files, the first written by me,
and the second a minor modification of the post linked in the comment
(which I found via altavista of "sbcl run-process :output :stream"). I
couldn't tell if there was any subtlety of loop that I might have been
missing, but I get identical behaviour in both cases.
Am I doing something wrong here?
(As an additional oddity: even though I have (finish-output
*standard-output*) after each format line I get no output until I kill
the hung dpkg-query process)
Thanks for any help :)