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

Truncation fails if new size is larger than the current file size #65

Closed
SailReal opened this issue May 2, 2022 · 0 comments · Fixed by #66
Closed

Truncation fails if new size is larger than the current file size #65

SailReal opened this issue May 2, 2022 · 0 comments · Fixed by #66

Comments

@SailReal
Copy link
Member

SailReal commented May 2, 2022

As FileChannel.html#truncate() of the Java NIO API doesn't follow the POSIX standard by not extending a file if it is shorter (by using zero bytes), we run into the following issue cryptomator/cryptomator#2218

From the doc:

If the given size is less than the file's current size then the file is truncated, discarding any bytes beyond the new end of the file. If the given size is greater than or equal to the file's current size then the file is not modified. In either case, if this channel's file position is greater than the given size then it is set to that size.

of https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/nio/channels/FileChannel.html#truncate(long)

SailReal added a commit that referenced this issue May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant