Opened 10 years ago

Last modified 9 years ago

#721 closed defect

read-string will drop last line if that line does not end with newline — at Initial Version

Reported by: Alan Post Owned by:
Priority: major Milestone: 4.9.0
Component: extensions Version: 4.7.x
Keywords: parley stdin pasting Cc:
Estimated difficulty:


The following program:

(let ((file (read-string)))
  (write file))

is a simple test of read-string. The following does not produce the result I expect:

$ csi test.scm < test.scm
"(let ((file (read-string)))  (write file))\n"

It appears if the newline in the middle of the file is not being preserved? Further, if I remove the "\n" from the test.scm file (please find it attached, I used a program called bvi to remove it, most editors will not let you save a file with a missing final newline), I get:

$ dd if=test.scm bs=1 count=42|csi test.scm
"(let ((file (read-string)))\n"

It seems the final line is being dropped! What is going on here? I expect read-string, when not given a size, to return my input file byte-for-byte?

Change History (1)

Changed 10 years ago by Alan Post

Attachment: test.scm added

test program with final newline removed.

Note: See TracTickets for help on using tickets.