Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • cmucl cmucl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 57
    • Issues 57
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cmucl
  • cmuclcmucl
  • Issues
  • #25
Closed
Open
Issue created Aug 02, 2016 by Elias Pipping@epippingContributor

Issue with ext:run-program and string streams (related to character sizes?)

I’ve been trying to launch an external process and pass input to it from a string. I’ve ended up with the following code which I think qualifies as a minimal example if you don’t count the debugging statements:

(let* ((in-string (format nil "A line.~%And another.~%")))
 (with-output-to-string (out-stream nil)
   (with-input-from-string (in-stream in-string)
     (ext:run-program "cat" nil
                      :wait t
                      :input in-stream
                      :output out-stream))
   (let ((out-string (get-output-stream-string out-stream)))
     (format t "Do the lengths match? ~a~%"
             (= (length in-string) (length out-string)))
     (format t "Do the contents match? ~a~%"
             (string= in-string out-string))
     (format t "Type of the in-string: ~a~%" (type-of in-string))
     (format t "Type of the out-string: ~a~%" (type-of out-string))
     (format t "This is what we sent:~%=====~%~a=====~%" in-string)
     (format t "This is what we received:~%=====~%~a=====~%" out-string))))

What it’s supposed to do is pass the string

A line.
And another.

to cat and print out the result, which should be the same string. That works for the most part but not entirely. The output I get is:

 Do the lengths match? T
 Do the contents match? NIL
 Type of the in-string: (SIMPLE-BASE-STRING 21)
 Type of the out-string: (SIMPLE-BASE-STRING 21)
 This is what we sent:
 =====
 A line.
 And another.
 =====
 This is what we received:
 =====
 A li
 And an
 =====

Two lines are received, but only their first half. Indeed, if I make that input lines longer, the output lines become longer as well. I would assume that this is down to a mix of character types of different sizes somewhere but I’ve been unable to get this code to work. So in particular I’m not sure if I’m doing something wrong or if this is a bug in cmucl (the example works with sbcl and ccl but I might still be doing something wrong).

Assignee
Assign to
Time tracking