> Yeah, I figured as much, but I shied away from reading the file in > bytevector chunks that would then need to be searched for control > characters to split the parts of the log file. I’ll probably do that > later, but for the first pass I just decided to use read-line. I understand. Binary read is a little painful. Perhaps you could use the read-bytes-till function in email/utils.scm of guile-email. It is kinda internal to guile-email. So, if you're using it, you should probably copy it into your source tree. > The mbox begins at the first ^G and ends at the next ^C. Ah, I see the problem. This is actually a bug on debbugs' part. The mbox/email starting at line 194 is invalid. It is neither a valid email nor a valid mbox. For it to be a valid mbox, the "From ..." line (currently at line 195) should be the first line. It should not occur in between the email headers as it does now. For it to be a valid email, the "From ..." line should not occur at all. I guess the only workaround is to find and delete the "From ..." line. Here's one possible way to do it. --8<---------------cut here---------------start------------->8--- (use-modules (email utils)) (parse-email (call-with-input-file "/path/to/40755.log" (lambda (port) (read-bytes-till port (make-bytevector 1 #x07)) (get-line port) (get-line port) (let ((possible-from-line (get-line port))) (unless (string-prefix? "From " possible-from-line) (unget-string port possible-from-line)) (read-bytes-till port (make-bytevector 1 #x03)))))) --8<---------------cut here---------------end--------------->8---