Opened 3 years ago

Closed 2 years ago

#1791 closed defect (worksforme)

format-date reports bad argument count

Reported by: Norman Gray Owned by: Kon Lovett
Priority: major Milestone: someday
Component: unknown Version: 5.2.0
Keywords: Cc:
Estimated difficulty:

Description

When I try to evaluate the following program with csi, I get an error

% cat try.scm
(import srfi-19-date srfi-19-io)
(write (format-date "~Y-~m-~d" (current-date)))

% csi try.scm
CHICKEN
(c) 2008-2020, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.2.0 (rev 317468e4)
macosx-unix-clang-x86-64 [ 64bit dload ptables ]

Type ,? for help.
; loading try.scm ...
; loading /Data/tools/chicken-5.2.0/lib/chicken/11/srfi-19-date.import.so ...
; loading /Data/tools/chicken-5.2.0/lib/chicken/11/srfi-19-io.import.so ...
; loading /Data/tools/chicken-5.2.0/lib/chicken/11/srfi-19-date.so ...
; loading /Data/tools/chicken-5.2.0/lib/chicken/11/srfi-1.so ...
[..blah...]
; loading /Data/tools/chicken-5.2.0/lib/chicken/11/exn-condition.so ...
; loading /Data/tools/chicken-5.2.0/lib/chicken/11/srfi-29-install.so ...

Error: bad argument count - received 0 but expected 1: #<procedure (chicken.base#open-input-string string)>

	Call history:

	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:144: char-downcase-single	  
	utf8-case-map.scm:50: utf8-lolevel#write-utf8-char	  
	utf8-case-map.scm:224: loop	  
	<syntax>	  (write "date is ~a~%" (format-date "~Y-~m-~d" (current-date)))
	<syntax>	  (format-date "~Y-~m-~d" (current-date))
	<syntax>	  (current-date)
	<eval>	  (write "date is ~a~%" (format-date "~Y-~m-~d" (current-date)))
	<eval>	  (format-date "~Y-~m-~d" (current-date))
	<eval>	  (current-date)	<--

If instead I compile it with csc and run it, then I get:

% ./try

Error: bad argument count - received 0 but expected 1: #<procedure (chicken.base#open-input-string string)>

	Call history:

	utf8-case-map.scm:222: utf8-lolevel#read-utf8-char	  
	utf8-case-map.scm:223: char-downcase-locale	  
	utf8-case-map.scm:215: char-downcase*	  
	utf8-case-map.scm:143: char-map-multi-case	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:117: loop	  
	utf8-case-map.scm:144: char-downcase-single	  
	utf8-case-map.scm:50: utf8-lolevel#write-utf8-char	  
	utf8-case-map.scm:224: loop	  
	try.scm:2: srfi-19-date#current-date	  
	try.scm:2: srfi-19-io#format-date	  	<--

which seems to be clearly pointing towards the same thing.

I'm sure this used to work (maybe in 5.0.0), so this appears to be a regression.

Change History (2)

comment:1 Changed 2 years ago by Kon Lovett

Owner: set to Kon Lovett
Status: newaccepted

comment:2 Changed 2 years ago by Kon Lovett

Resolution: worksforme
Status: acceptedclosed

#585 $ csi -n
CHICKEN
(c) 2008-2022, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.3.1 (kinda-fixed) (rev 4ac147d8)
macosx-unix-clang-x86-64 [ 64bit dload ptables ]

Type ,? for help.
#;1> (import srfi-19-date srfi-19-io)
[..blah...]
#;2> (write (format-date "~Y-~m-~d" (current-date)))
"2022-06-25"#;3>

Note: See TracTickets for help on using tickets.