bugMIT/GNU Scheme - Bugs: bug #67109, #\return ignored when reading from...

 
 

bug #67109: #\return ignored when reading from (current-input-port)

Submitter:  None
Submitted:  Fri 09 May 2025 10:17:44 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect behavior
Status:  None Privacy:  Public
Assigned to:  None Originator Name:  Retropikzel
Originator Email:  -email is unavailable- Open/Closed:  Open
Keywords: 
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Fri 09 May 2025 10:17:44 AM UTC, original submission:  

I’m making a portable CGI library and reading characters from the (current-input-port), I noticed that MIT-scheme leaves out #\return characters when reading from (current-input-port). I’ve made a some tests to showcase the bug.

read-char.scm:
(import (scheme base)
        (scheme read)
        (scheme write))

(letrec* ((looper (lambda ()
                    (let ((c (read-char (current-input-port))))
                      (when (not (eof-object? c))
                        (write c)
                        (newline)
                        (looper))))))
  (looper))


Run with: printf "Hello\r\n" | <IMPLEMENTATION COMMAND> read-char.scm

Output on Chibi, Chicken, Cyclone, Gambit(interpreter), Foment, Gauche, Guile, Kawa, Larceny, Racket, Skint, Stklos, tr7:

#\H
#\e
#\l
#\l
#\o
#\return
#\newline

Output on mit-scheme, Sagittarius:
#\H
#\e
#\l
#\l
#\o
#\newline

Output on Loko, Mosh, ypsilon:
#\H
#\e
#\l
#\l
#\o
#\linefeed


read-string.scm:
(import (scheme base)
        (scheme read)
        (scheme write))

(define text-port (open-input-string (string-append "Hello"
                                                    (string #\return)
                                                    (string #\newline))))
(letrec* ((looper (lambda ()
                    (let ((c (read-char text-port)))
                      (when (not (eof-object? c))
                        (write c)
                        (newline)
                        (looper))))))
  (looper))

Run with: <IMPLEMENTATION COMMAND> read-string.scm

Output on Chibi, Chicken, Cyclone, Gambit(interpreter) Foment, Gauche, Guile, Kawa, Larceny, mit-scheme, Racket, Sagittarius, skint, STklos, tr7:
#\H
#\e
#\l
#\l
#\o
#\return
#\newline

Output on Loko, Mosh, ypsilon:
#\H
#\e
#\l
#\l
#\o
#\return
#\linefeed

Anonymous

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code