As discussed on newsgroup "comp.emacs.xemacs" I noted that "mmencode" from the XEmacs MS Windows distribution (XEmacs 21.4 (patch 19) "Constant Variable" [Lucid] (i586-pc-win32) of Sat Jan 28 2006 on VSHELTON-PC2) would often hang when decoding email attachments. Adrian Aichner responded that he had seen similar behaviour and suggested moving the discussion to "xemacs-b...@xemacs.org". At "xemacs-b...@xemacs.org" Stephen J. Turnbull responded to Adrian's email & asked for example files that caused the problem.
I have a few examples that exhibit the same behaviour on two different PCs: one a HP laptop and the other a Gateway desktop. They differ in processor speed and in operating system. The former has Windows XP Home; the latter has Windows XP professional. The former is a personal machine & the latter is a work machine.
The files of interest are:
base64_coded_07_044 | (original PDF file, caused hangs) |
base64_coded_07_044_shortened_10 | (shortened PDF file, causes hangs) |
base64_coded_07_044_shortened_11 | (shortened PDF file, doesn't hang) |
base64_coded_07_044_shortened_12 | (shortened PDF file, causes hangs) |
File "base64_coded_07_044" is an encoded PDF file. It causes a hang, when a line like:
(apply 'call-process "mmencode" "d:\\Temporary\\work\\mmencode_tests\\base64_coded_07_044_shortened_10" t nil '("-u"))
is evaluated. To exit from the hang, I use the Windows Task Manager to kill off the "mmencode" process.
I then used "base64-decode-region" and "base64-encode-region" and removed enough lines at the end of the file so that it wouldn't hang. The result was "base64_coded_07_044_shortened_11". File "base64_coded_07_044_shortened_10" has one line added back in & does hang. File "base64_coded_07_044_shortened_12" takes the bottom line of "base64_coded_07_044_shortened_11" and duplicates it; it also hangs.
The file diff.txt shows "diff" output for the decoded versions of these files--comparing them in various ways.
The file directory.txt shows the result of "ls -ql" (using Cygwin, bash and ls in a XEmacs shell buffer) on my laptop.
Although I noted that "call-process-internal" for 21.4.19 and for 21.5 (as in Adrian's case) differ, I found the equivalent place in "call-process-internal" to put "(sit-for 0.05)" & that cured the "hangs".
I was then curious about FSF Emacs and installed Emacs version 22.1 on my laptop. I noted there that "call-process" is a primitive function--not in lisp, but in C.
I tried tests of "mmencode" with "call-process" in the case of Emacs 22.1 and experienced no hangs.
As a different test (in XEmacs again) I made up a file with multiples of
the quick brown fox jumped over the lazy yellow dog
0123456789
and made files with as many characters as base64_coded_07_044 decoded. I then encoded that file and did a test of decoding it with "mmencode". I had no hang. I did similar tests with a factor of 2 and a factor of 3 times as many characters. No hang resulted. I didn't try going further.