Summary
parley constructs an internally inconsistent input port
Metadata
- Id: 2e65a0242f6cc27c23359068c79d637fb4ec808c
- Trac id: 1801
- Type: defect
- Reporter: wasamasa
- Owner:
- Cc: ckeen
- Status: new
- Component: extensions
- Estimated difficulty: trivial
- Resolution:
- Priority: minor
- Milestone: someday
- Version: 5.3.0
- Changetime: 2022-04-27 06:58:43 UTC
- Created: 2022-04-26 11:50:50 UTC
- Keywords: parley port
Description
The parley egg still hasn't been ported successfully to C5. Most of the steps are done already (egg file, imports, tests), but interactive usage fails:
#;2> (define p (let ((old (current-input-port))) (make-parley-port old)))
#;3> p
#<port "(parley)">
#;4> (input-port? (current-input-port))
#t
#;5> (input-port? p)
#t
#;6> (current-input-port p)
Error: (current-input-port) bad argument type - not a port of the correct type: #<port "(parley)">
Call history:
<syntax> (current-input-port p)
<eval> (current-input-port p) <--
Looking at the code performing checks, it seems that the I/O direction slot is checked whether it's an input one. Both `input-port?` and `current-input-port` seem to look at the same slot, but arrive to different conclusions. Perhaps C5 changed some port internals?
One way of side-stepping this would be to avoid low-level port construction, but this might break C4 compatibility completely.
Changes and comments
[2022-04-26 12:56:48 UTC] wasamasa wrote:
> <mario-goulart> wasamasa: last time I checked, http://parenteses.org/mario/misc/parley-patches/0001-CHICKEN-5-support.patch and http://parenteses.org/mario/misc/parley-patches/0002-Adapt-Kooda-s-change-on-top-of-mine.patch were enough to make parley work.
I've confirmed the above two patches do the trick on an unmodified copy of parley-0.9.4. Therefore they can be used as is by the egg author to port it to C5. Feel free to close once it's been released.
[2022-04-26 12:56:59 UTC] wasamasa changed difficulty from medium to trivial
[2022-04-27 06:56:02 UTC] evhan wrote:
> Perhaps C5 changed some port internals?
It did, the direction slot changed from a boolean to a bitmask.
For code that is rummaging around inside a port's internals, if you want to know whether a port is open for input, you can check the first slot of the port for `0x1` (or `0x2` for output).
Not sure if that helps, just for the record.
[2022-04-27 06:56:02 UTC] evhan wrote:
1651035396360516
[2022-04-27 06:56:02 UTC] evhan wrote:
1651035523278091