8227609: (fs) Files.newInputStream(...).skip(n) should allow skipping beyond file size
Florian Weimer
fweimer at redhat.com
Fri Jul 26 15:06:27 UTC 2019
* Brian Burkhalter:
> On Jul 26, 2019, at 7:53 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>
> I saw a test failure in the CI system with this:
> ----------System.err:(18/1120)----------
> java.io.IOException: Invalid argument
> at java.base/sun.nio.ch.FileDispatcherImpl.seek0(Native Method)
> at java.base/sun.nio.ch.FileDispatcherImpl.seek(FileDispatcherImpl.java:78)
> at java.base/sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:361)
> at java.base/sun.nio.ch.FileChannelImpl.position(FileChannelImpl.java:52)
> at java.base/sun.nio.ch.ChannelInputStream.skip(ChannelInputStream.java:132)
> at InputStreamTest.testSkip(InputStreamTest.java:115)
> InputStreamTest.java;
> 112 assertTrue(in.skip(size/2) == size/2); // 0.5
> 113 assertTrue(in.available() == size/2);
> 114
> 115 assertTrue(in.skip(Long.MAX_VALUE - size/4) ==
> 116 Long.MAX_VALUE - size/2);
> 117 assertTrue(in.available() == 0);
> It looks as if for some case lseek64() doesn’t like an argument of Long.MAX_VALUE. I’ll need to run this down before checking
> anything in.
>
> This was on Linux-x64.
On ext4? The EINVAL depends on the file system. XFS supports arbitrary
offsets, but ext4 does not, for example.
We discussed this recently on another thread:
From: Karan Mehta <k.mehta at salesforce.com>
Date: Tue, 4 Jun 2019 10:13:05 -0700
Subject: Invalid argument exception when trying to seek FilePosition to
LONG.MAX_VALUE
To: nio-dev at openjdk.java.net
Message-ID: <CANpNY381LM5XRd2GCc93V1sDuc4JoDoctv83Ur75XfhoGPvF=w at mail.gmail.com>
Thanks,
Florian
More information about the nio-dev
mailing list