Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPEND file-port crash #1894

Open
rebolbot opened this issue Oct 12, 2011 · 4 comments
Open

APPEND file-port crash #1894

rebolbot opened this issue Oct 12, 2011 · 4 comments

Comments

@rebolbot
Copy link
Collaborator

Submitted by: Ladislav

The code below crashes the interpreter

port: open/new %pokus.txt
append port newline

CC - Data [ Version: alpha 111 Type: Bug Platform: All Category: Ports Reproduce: Always Fixed-in:none ]

@rebolbot
Copy link
Collaborator Author

Submitted by: BrianH

File ports don't support the APPEND action - you're supposed to use WRITE/append instead, like this:

port: open/new %pokus.txt
write/append port to-string newline  ; You can't write a character without converting it to string or binary first

Still, it shouldn't crash. The relevant code may be in the host source, and if so we can fix it ourselves.

@rebolbot
Copy link
Collaborator Author

Submitted by: Ladislav

in the core-tests suite

@rebolbot
Copy link
Collaborator Author

Submitted by: abolka

Currently, APPEND on a file port! is just a shortcut for WRITE/append. Should we keep that behaviour, or disallow APPEND on file port!s altogether, for now?

@rebolbot
Copy link
Collaborator Author

Submitted by: abolka

Fix for the crash submitted:

https://github.com/rebol/rebol/pull/212

Note that this fix tightens the effective type spec for APPEND on file ports. Disallowing APPEND on file ports altogether should still be discussed. We could also discuss relaxing APPEND on file ports so that it automatically converts to binary for non-binary values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants