RUN-PROGRAM encoding error leading to messed up state

Bug #2110532 reported by Gábor Melis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Incomplete
Undecided
Unassigned

Bug Description

Something similar to https://bugs.launchpad.net/sbcl/+bug/840190 still happens, although I can reproduce it only under Slime.

```
cat barf2.lisp
(defun barf ()
  (with-output-to-string (stream)
    (run-program "/usr/bin/pdfinfo"
                 '("barf.pdf")
                 :output stream)))

(defun barf2 ()
  (let ((proc (sb-ext:run-program
               "/usr/bin/pandoc"
               (list "-f" "markdown"
                     "-t" "pdf"
                     "-o" "-")
               :input :stream
               :output *standard-output*
               :wait nil))
        (ok nil))
    (unwind-protect
         (prog1
             (with-open-stream (stream (sb-ext:process-input proc))
               (format stream "hello~%"))
           (sb-ext:process-wait proc)
           (setf ok t))
      (sb-ext:process-close proc)
      (unless ok
        (sb-ext:process-kill proc -9)))))
```

Load `barf2.lisp` under Slime. Then, *in the Slime repl*,

1. evaluate `(BARF)` (should work fine)
2. evaluate `(BARF2)` (fails with `Illegal :UTF-8 character starting at byte position 10.`)
3. evaluate `(BARF2)` again and maybe get `non-empty buffer when EOF reached while reading from child`

This is not entirely deterministic, so try a couple of times. After a `non-empty buffer` error, even `(BARF)` fails with `Illegal :UTF-8`.

This is with SBCL 2.5.4.74-ddacb9c2e on Linux x86-64.

Revision history for this message
Richard M Kreuter (kreuter) wrote :

Is the Slime REPL's output channel bivalent? (I don't see anything in Swank that would create a bivalent SBCL stream.)

Revision history for this message
Stas Boukarev (stassats) wrote :

The only thing I could do to trigger an error is

(sb-ext:run-program "sbcl" '("--noinform" "--eval" "(map nil (lambda (b) (write-char #\\a *error-output*) (finish-output *error-output*) (write-byte b *standard-output*) (finish-output) ) (sb-ext:string-to-octets \"å∑ç\"))" "--quit")
                    :search t
                    :output *standard-output*)

Is your test case doing the same?

Stas Boukarev (stassats)
Changed in sbcl:
status: New → Incomplete
Revision history for this message
Gábor Melis (melisgl) wrote :

With your test case, I only got the illegal utf 8 character error from a couple of tries (restarting SBCL 4 times, running SLIME). With mine, I also get the non-empty buffer error sometimes, which is sticky (even BARF fails after it).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.