Read-line issue in Win64 when reading files.

Uģis Lācis <[email protected]> Fri, 21 Nov 2025 11:12:02 +0000
Newsgroups gmane.lisp.steel-bank.general
Message-ID <GV3P280MB14205972B725BC5DD6ED823190D5A@GV3P280MB1420.SWEP280.PROD.OUTLOOK.COM>
Hi SBCL users and developers,

I recently stumbled upon a problem with (read-line) using Win64 version of SBCL. It seems very similar to this old bug:
Bug #1587197 “read-line in Win64 is non-conforming” : Bugs : SBCL<https://bugs.launchpad.net/sbcl/+bug/1587197>

However, also for file access. To recreate, use the simple attached text example by executing:
* (load "read-line.lisp")
T
* (test-reading)
  0: (READ-LINE
      #<SB-SYS:FD-STREAM for "file C:\\example_text_windows.txt" {1101C8F9F3}>)
" NILREAD-LINE returned "Some text in first line
#\Return
*

What happens is essentially the same as described in the bug, read-line returns a non-clean string, i.e., last character being “#\Return”. This is a bit annoying as I am often trying to compare the read-line result with some string and “#\Return” character screws up the comparison. As a workaround, I have implemented a wrapper function to remove the trailing “#\Return” character, but I wonder if there is any plan to fix this bug? I did the above test in the latest SBCL build for Win64, 2.5.10.

Best wishes,
Ugis

_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help
example_text_windows.txt (text/plain, 78 B)
Some text in first line
1 3 5t1 551 12 54
Then another line
And yet another
read-line.lisp (application/octet-stream, 418 B) - not displayed