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

ERL-1299: file:pwrite/3 only accepts integer positions when used with ram files #4351

Closed
OTP-Maintainer opened this issue Jul 1, 2020 · 2 comments
Assignees
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: JIRAUSER15707
Affected version: OTP-22.0
Fixed in version: OTP-23.1
Component: kernel
Migrated from: https://bugs.erlang.org/browse/ERL-1299


The documentation for [file:pwrite/3|http://erlang.org/doc/man/file.html#pwrite-3] lists limitations when using this function with "raw" files, but there are similar limitations when used with "ram" files.

For example, the function fails when given "eof"

{code:erlang}
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V10.7.1  (abort with ^G)
1> {ok, File} = file:open(<<"hello">>, [ram, write, read]).
{ok,{file_descriptor,ram_file,#Port<0.6>}}
2> file:pwrite(File, eof, <<" world">>).
{error,badarg}
3>
{code}

but works when given an integer position

{code:erlang}
Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Eshell V10.7.1  (abort with ^G)
1> {ok, File} = file:open(<<"hello">>, [ram, write, read]).
{ok,{file_descriptor,ram_file,#Port<0.6>}}
2> file:pwrite(File, 5, <<" world">>).
ok
3>
{code}

Either the documentation should be fixed to report the limitations of using this function with "ram" files, or this function should be fixed to remove this limitation with "ram" files.

Thanks.

@OTP-Maintainer
Copy link
Author

sverker said:

Documentation improved by

[https://github.com/erlang/otp/pull/2724]

 

@OTP-Maintainer
Copy link
Author

sverker said:

Documentation fix scheduled for OTP-23.1

 

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:VM Assigned to OTP team VM priority:medium labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-23.1 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants