Seekable file handles allow seeking to `-1`
MasonGulu opened this issue · comments
MasonGulu commented
Describe the bug
When using seek
on a seekable file handle you can seek to -1. After this happens any further calls to seek
don't change your position in the file, keeping the file handle at -1. Any attempt to write/read the file afterwards results in an error along the lines of "cannot write file"
To Reproduce
Steps to reproduce the behavior:
- Open
lua
- Create a
wb
orrb
file handle - Call
seek(nil, -1)
- Profits?
Expected behavior
CC on 1.19.3 returns nil and an error string "Position is negative" when attempting to seek below 0.
Environment (please complete the following information):
- OS: Kubuntu
- OS Version: 22.04
- CraftOS-PC Version: v2.7.2
- Compiled from source? No
Additional context
Add any other context about the problem here.
MasonGulu commented