Debian Bug report logs - #571532
gcj-4.4: FileChannel.transferTo() does not conform to java specification (gij: Bus error when executing ant)

Package: gcj-4.4; Maintainer for gcj-4.4 is Debian GCC Maintainers <debian-gcc@lists.debian.org>;

Reported by: Torsten Werner <twerner@debian.org>

Date: Thu, 25 Feb 2010 20:09:02 UTC

Severity: normal

Tags: upstream

Forwarded to http://gcc.gnu.org/PR43717

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, debian-java@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Thu, 25 Feb 2010 20:09:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Torsten Werner <twerner@debian.org>:
New Bug report received and forwarded. Copy sent to debian-java@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Thu, 25 Feb 2010 20:09:05 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Torsten Werner <twerner@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: gij: Bus error when executing ant
Date: Thu, 25 Feb 2010 20:08:05 +0000
[Message part 1 (text/plain, inline)]
Package: gij
Version: 4:4.4.2-3
Severity: critical
Justification: breaks unrelated software

Hi,

gij fails with bus error when execution ant (1.8) and causes many FTBFS errors.
An example to reproduce the problem will be attached.

Cheers,
Torsten
[build.xml (application/xml, attachment)]
[source (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Thu, 25 Feb 2010 21:45:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Thu, 25 Feb 2010 21:45:10 GMT) Full text and rfc822 format available.

Message #10 received at 571532@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: Torsten Werner <twerner@debian.org>, 571532@bugs.debian.org
Cc: Debian Bug Tracking System <control@bugs.debian.org>
Subject: Re: Bug#571532: gij: Bus error when executing ant
Date: Thu, 25 Feb 2010 22:43:25 +0100
clone 571532 -1
reassign -1 ant
thanks

so why does 1.7 work, and not 1.8? If we cannot resolve this, we should release 
squeeze with 1.7.

I don't plan to work on this myself.

On 25.02.2010 21:08, Torsten Werner wrote:
> Package: gij
> Version: 4:4.4.2-3
> Severity: critical
> Justification: breaks unrelated software
>
> Hi,
>
> gij fails with bus error when execution ant (1.8) and causes many FTBFS errors.
> An example to reproduce the problem will be attached.





Bug 571532 cloned as bug 571542. Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Thu, 25 Feb 2010 21:45:14 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Thu, 25 Feb 2010 22:21:17 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Thu, 25 Feb 2010 22:21:17 GMT) Full text and rfc822 format available.

Message #17 received at 571532@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: debian-hppa@lists.debian.org
Cc: 570889@bugs.debian.org, 571532@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: #570889 ant: FTBFS on kfreebsd-* and hppa: Bus error
Date: Fri, 26 Feb 2010 01:22:27 +0100 (CET)
> On Thu, Feb 25, 2010 at 9:23 AM, Petr Salinger <Petr.Salinger@seznam.cz> wrote:
>> The file, which have to be copied, have size 1701,
>> but two pages (2*4096) are mmaped. It is allowed on both
>> Linux and FreeBSD.
>> When the 2nd page of that file would be accessed, it would
>> generate SIGBUS.
>>
>> The question is of course whether it really happens and why ?

> File descriptor 0 is standard input and you can't mmap that.
> You should also check the return of mmap.
> Could you please provide a new test case?

Please really try to run the example code,
for me (pagesize 4096) it gives:

0x800636000 32
0x800636000 0
Bus error

The example code just illustrates what might happen in
failure of ant. The affected architectures directly in
ant build have been only kfreebsd-* and hppa.

Now it looks like wider problem - #571532, #571542, #571397.

Petr





Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Fri, 26 Feb 2010 03:39:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Carlos O'Donell" <carlos@systemhalted.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Fri, 26 Feb 2010 03:39:04 GMT) Full text and rfc822 format available.

Message #22 received at 571532@bugs.debian.org (full text, mbox):

From: "Carlos O'Donell" <carlos@systemhalted.org>
To: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: debian-hppa@lists.debian.org, 570889@bugs.debian.org, 571532@bugs.debian.org, debian-bsd@lists.debian.org
Subject: Re: #570889 ant: FTBFS on kfreebsd-* and hppa: Bus error
Date: Thu, 25 Feb 2010 22:37:12 -0500
On Thu, Feb 25, 2010 at 7:22 PM, Petr Salinger <Petr.Salinger@seznam.cz> wrote:
>> On Thu, Feb 25, 2010 at 9:23 AM, Petr Salinger <Petr.Salinger@seznam.cz>
>> wrote:
>>>
>>> The file, which have to be copied, have size 1701,
>>> but two pages (2*4096) are mmaped. It is allowed on both
>>> Linux and FreeBSD.
>>> When the 2nd page of that file would be accessed, it would
>>> generate SIGBUS.
>>>
>>> The question is of course whether it really happens and why ?
>
>> File descriptor 0 is standard input and you can't mmap that.
>> You should also check the return of mmap.
>> Could you please provide a new test case?
>
> Please really try to run the example code,
> for me (pagesize 4096) it gives:
>
> 0x800636000 32
> 0x800636000 0
> Bus error
>
> The example code just illustrates what might happen in
> failure of ant. The affected architectures directly in
> ant build have been only kfreebsd-* and hppa.
>
> Now it looks like wider problem - #571532, #571542, #571397.

Does ant actually try to mmap stdin? That's a bug in ant.

POSIX says you may only mmap a file, shared memory object,
or typed memory object. The stdin file descriptor is neither
of those things therefore you can't mmap stdin.

One might argue the bug is that the Linux kernel allows the
mmap to succeed.

Cheers,
Carlos.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Fri, 26 Feb 2010 06:12:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Fri, 26 Feb 2010 06:12:08 GMT) Full text and rfc822 format available.

Message #27 received at 571532@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: "Carlos O'Donell" <carlos@systemhalted.org>
Cc: 570889@bugs.debian.org, 571532@bugs.debian.org
Subject: Re: #570889 ant: FTBFS on kfreebsd-* and hppa: Bus error
Date: Fri, 26 Feb 2010 09:14:19 +0100 (CET)
>> Now it looks like wider problem - #571532, #571542, #571397.
>
> Does ant actually try to mmap stdin? That's a bug in ant.
>
> POSIX says you may only mmap a file, shared memory object,
> or typed memory object. The stdin file descriptor is neither
> of those things therefore you can't mmap stdin.

No, no, no. Not in my example:
  gcc tst.c -o tst
  tst < tst.c

My point is a different one, see in #570889.

14997 gij-4.4  CALL  open(0x8e59e58,O_RDONLY|O_LARGEFILE,<unused>0)
14997 gij-4.4  NAMI ".../defaults.properties"
14997 gij-4.4  RET   open 10/0xa
14997 gij-4.4  CALL  fstat(0xa,0xbfbf29ec)
14997 gij-4.4  STRU  size=1701
14997 gij-4.4  RET   fstat 0
14997 gij-4.4  CALL  mmap(0,0x2000,PROT_READ,MAP_PRIVATE,0xa,0,0)
14997 gij-4.4  RET   mmap 712716288/0x2a7b3000
14997 gij-4.4  PSIG  SIGBUS SIG_DFL

The ant/gij-4.4 mmaps 8192 bytes from file of size 1701
on architecture with pagesize 4096.

It is at least weird, possible consequences are demonstrated
by my tst.c example.

Petr





Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Fri, 26 Feb 2010 07:03:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Carlos O'Donell" <carlos@systemhalted.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Fri, 26 Feb 2010 07:03:05 GMT) Full text and rfc822 format available.

Message #32 received at 571532@bugs.debian.org (full text, mbox):

From: "Carlos O'Donell" <carlos@systemhalted.org>
To: Petr Salinger <Petr.Salinger@seznam.cz>
Cc: 570889@bugs.debian.org, 571532@bugs.debian.org
Subject: Re: #570889 ant: FTBFS on kfreebsd-* and hppa: Bus error
Date: Fri, 26 Feb 2010 02:02:08 -0500
On Fri, Feb 26, 2010 at 3:14 AM, Petr Salinger <Petr.Salinger@seznam.cz> wrote:
> My point is a different one, see in #570889.
>
> 14997 gij-4.4  CALL  open(0x8e59e58,O_RDONLY|O_LARGEFILE,<unused>0)
> 14997 gij-4.4  NAMI ".../defaults.properties"
> 14997 gij-4.4  RET   open 10/0xa
> 14997 gij-4.4  CALL  fstat(0xa,0xbfbf29ec)
> 14997 gij-4.4  STRU  size=1701
> 14997 gij-4.4  RET   fstat 0
> 14997 gij-4.4  CALL  mmap(0,0x2000,PROT_READ,MAP_PRIVATE,0xa,0,0)
> 14997 gij-4.4  RET   mmap 712716288/0x2a7b3000
> 14997 gij-4.4  PSIG  SIGBUS SIG_DFL
>
> The ant/gij-4.4 mmaps 8192 bytes from file of size 1701
> on architecture with pagesize 4096.

If ant mmap's a file that has only 1701 bytes, on an architecture with
page size of 4906, then any access beyond the first page will cause a
SIGBUS.

POSIX mmap says:
* The system will zero-fill a partial page at the end of an object.
Thus bytes 1701->4095 are zero-filled.
* Access to any whole page past the end of an object shall result in
SIGBUS. Thus access to bytes 4096->8192 will result in a SIGBUS.

If ant is accessing whole pages beyond the length of the object (not
the length of the required mmap) then this is a bug.

Cheers,
Carlos.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Sat, 27 Feb 2010 17:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mail.twerner@googlemail.com:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sat, 27 Feb 2010 17:12:02 GMT) Full text and rfc822 format available.

Message #37 received at 571532@bugs.debian.org (full text, mbox):

From: Torsten Werner <twerner@debian.org>
To: Debian Java List <debian-java@lists.debian.org>
Cc: 571532@bugs.debian.org, Debian Bug Tracking System <control@bugs.debian.org>
Subject: Re: Bug#571532: gij: Bus error when executing ant
Date: Sat, 27 Feb 2010 18:08:55 +0100
severity 571532 important
thanks

On Thu, Feb 25, 2010 at 10:43 PM, Matthias Klose <doko@debian.org> wrote:
> so why does 1.7 work, and not 1.8?

I have no idea why gij fails with bus error. I have uploaded a new
source package ant1.7 that can be used by packages that are arch
dependent. Downgrading the severity because we will have a workaround.

Torsten




Severity set to 'important' from 'critical' Request was from Torsten Werner <twerner@debian.org> to control@bugs.debian.org. (Sat, 27 Feb 2010 17:12:06 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Sat, 27 Feb 2010 18:42:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sat, 27 Feb 2010 18:42:06 GMT) Full text and rfc822 format available.

Message #44 received at 571532@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: 571532@bugs.debian.org
Cc: Torsten Werner <twerner@debian.org>, Debian Java List <debian-java@lists.debian.org>, Debian Bug Tracking System <control@bugs.debian.org>
Subject: Re: Bug#571532: gij: Bus error when executing ant
Date: Sat, 27 Feb 2010 19:39:43 +0100
severity 571532 grave
thanks

On 27.02.2010 18:08, Torsten Werner wrote:
> severity 571532 important
> thanks
>
> On Thu, Feb 25, 2010 at 10:43 PM, Matthias Klose<doko@debian.org>  wrote:
>> so why does 1.7 work, and not 1.8?
>
> I have no idea why gij fails with bus error. I have uploaded a new
> source package ant1.7 that can be used by packages that are arch
> dependent. Downgrading the severity because we will have a workaround.

We are short before the freeze; the release architectures still include 
architectures which require gij in it's current form (hppa, kfreebsd-i386 and 
kfreebsd-amd64). Please either port OpenJDK to these archs (hey, you're still an 
OpenJDK maintainer ;), or stay with the current ant version in testing. 
Packaging the 1.8 version as ant1.8 might be the better choice.

  Matthias




Severity set to 'grave' from 'important' Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sat, 27 Feb 2010 18:42:07 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Tue, 09 Mar 2010 09:30:23 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Tue, 09 Mar 2010 09:30:23 GMT) Full text and rfc822 format available.

Message #51 received at 571532@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: 571542@bugs.debian.org
Cc: 571532@bugs.debian.org, control@bugs.debian.org
Subject: [patch] ant FTBFS on gcj architectures
Date: Tue, 9 Mar 2010 12:33:36 +0100 (CET)
notfixed 571542 1.8.0-3
found 571542 1.8.0-3
tags 571542 +patch
--

Hello.

The problem is that FileUtils.BUF_SIZE (8192)
is currently bigger than page size (4096) on
some architectures, the copied file is mmaped-in
and the code tries to access after end of a file.

The patch bellow will provide functional ant 1.8 on gij architectures 
and you can provide -gcj packages again on all architectures.

It would also be nice if you can inform upstream(s)
about this issue.

Thanks in advance

			Petr

--- src/main/org/apache/tools/ant/util/ResourceUtils.java
+++ src/main/org/apache/tools/ant/util/ResourceUtils.java
@@ -463,10 +463,15 @@
                 destChannel = out.getChannel();

                 long position = 0;
+                long bufsize = FileUtils.BUF_SIZE;
                 long count = srcChannel.size();
                 while (position < count) {
+                    if (bufsize > (count - position))
+                    {
+                       bufsize = count - position;
+                    }
                     position +=
-                        srcChannel.transferTo(position, FileUtils.BUF_SIZE,
+                        srcChannel.transferTo(position, bufsize,
                                               destChannel);
                 }
             } finally {





Bug reassigned from package 'gij' to 'ant'. Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sun, 14 Mar 2010 03:33:04 GMT) Full text and rfc822 format available.

Bug No longer marked as found in versions gcc-defaults/1.92. Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sun, 14 Mar 2010 03:33:05 GMT) Full text and rfc822 format available.

Bug reassigned from package 'ant' to 'gij'. Request was from Torsten Werner <mail.twerner@googlemail.com> to control@bugs.debian.org. (Sun, 14 Mar 2010 09:45:17 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Sun, 14 Mar 2010 09:45:20 GMT) Full text and rfc822 format available.

Acknowledgement sent to Torsten Werner <mail.twerner@googlemail.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sun, 14 Mar 2010 09:45:20 GMT) Full text and rfc822 format available.

Message #62 received at 571532@bugs.debian.org (full text, mbox):

From: Torsten Werner <mail.twerner@googlemail.com>
To: 571532@bugs.debian.org
Cc: Debian Bug Tracking System <control@bugs.debian.org>
Subject: gij: Bus error when executing ant
Date: Sun, 14 Mar 2010 10:44:27 +0100
reassign 571532 gij
thanks

Please never reassign bugs without giving an explaination. Ant's
upstream developers argue
<https://issues.apache.org/bugzilla/show_bug.cgi?id=48894> that this
is a bug in gij or its libraries. We have a workaround now but the bug
in gij is still there.

Torsten




Bug Marked as found in versions gcc-defaults/1.92. Request was from Gerfried Fuchs <rhonda@debian.at> to control@bugs.debian.org. (Sun, 14 Mar 2010 10:21:14 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Sun, 14 Mar 2010 12:54:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Klose <doko@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sun, 14 Mar 2010 12:54:03 GMT) Full text and rfc822 format available.

Message #69 received at 571532@bugs.debian.org (full text, mbox):

From: Matthias Klose <doko@debian.org>
To: Torsten Werner <mail.twerner@googlemail.com>, 571532@bugs.debian.org
Subject: Re: Bug#571532: gij: Bus error when executing ant
Date: Sun, 14 Mar 2010 13:51:18 +0100
severity 571532 normal
tags 571532 + moreinfo
tags 571532 + help
thanks

On 14.03.2010 10:44, Torsten Werner wrote:
> reassign 571532 gij
> thanks
>
> Please never reassign bugs without giving an explaination.

right, there was no information when it was reassigned to gij.

> Ant's upstream developers argue
> <https://issues.apache.org/bugzilla/show_bug.cgi?id=48894>  that this
> is a bug in gij or its libraries. We have a workaround now but the bug
> in gij is still there.
>
> Torsten
>
>
>





Severity set to 'normal' from 'grave' Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sun, 14 Mar 2010 12:54:06 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sun, 14 Mar 2010 12:54:07 GMT) Full text and rfc822 format available.

Added tag(s) help. Request was from Matthias Klose <doko@debian.org> to control@bugs.debian.org. (Sun, 14 Mar 2010 12:54:08 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Sun, 14 Mar 2010 13:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mail.twerner@googlemail.com:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Sun, 14 Mar 2010 13:42:03 GMT) Full text and rfc822 format available.

Message #80 received at 571532@bugs.debian.org (full text, mbox):

From: Torsten Werner <twerner@debian.org>
To: Matthias Klose <doko@debian.org>
Cc: 571532@bugs.debian.org
Subject: Re: Bug#571532: gij: Bus error when executing ant
Date: Sun, 14 Mar 2010 14:38:37 +0100
On Sun, Mar 14, 2010 at 1:51 PM, Matthias Klose <doko@debian.org> wrote:
> right, there was no information when it was reassigned to gij.

This bug never got reassigned to gij. It was reported against gij in
the first place.

Torsten




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Mon, 15 Mar 2010 07:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Mon, 15 Mar 2010 07:57:02 GMT) Full text and rfc822 format available.

Message #85 received at 571532@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: 571532@bugs.debian.org
Subject: Bug#571532: gij: Bus error when executing ant
Date: Mon, 15 Mar 2010 10:59:16 +0100 (CET)
Hi.

The problem is triggered by this line, for any small file,
which seems to me allowed by java specification

srcChannel.transferTo(0, FileUtils.BUF_SIZE,destChannel);

http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/FileChannel.html:

  An attempt is made to read up to count bytes from the source channel and
  write them to this channel's file starting at the given position. An
  invocation of this method may or may not transfer all of the requested
  bytes; whether or not it does so depends upon the natures and states of
  the channels. Fewer than the requested number of bytes will be
  transferred
  if the source channel has fewer than count bytes remaining, or if the
  source channel is non-blocking and has fewer than count bytes
  immediately available in its input buffer.

It is implemented in 
libjava/gnu/java/nio/channels/FileChannelImpl.java
via smallTransferTo() via map() via mapImpl().

The specification of map() explicitely states:

  Many of the details of memory-mapped files are inherently dependent upon
  the underlying operating system and are therefore unspecified. The
  behavior of this method when the requested region is not completely
  contained within this channel's file is unspecified.

The transferTo(0, 8192, ...) is translated into mmap() of 8192 
bytes from file of size 1701 on architecture with pagesize 4096.
This system call succeeds, the later acces to 2nd page fails.
Moreover, it looks like transferTo(0, 4096, ...) would write
4096 bytes to destination file from file with size 1701.

IMHO, the implementaion of smallTransferTo() should be fixed.

Petr




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gij. (Mon, 15 Mar 2010 17:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Mon, 15 Mar 2010 17:03:02 GMT) Full text and rfc822 format available.

Message #90 received at 571532@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: 571532@bugs.debian.org
Subject: Bug#571532: gij: Bus error when executing ant
Date: Mon, 15 Mar 2010 20:04:34 +0100 (CET)

> Moreover, it looks like transferTo(0, 4096, ...) would write
> 4096 bytes to destination file from file with size 1701.

It can be shown by this snippet:

-----------------------------------------
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;

public class Tra {

  public static void main(String[] args) throws Exception {
    if (args.length != 2) {
      System.out.println("arguments: sourcefile destfile");
      System.exit(1);
    }
    FileChannel in = new FileInputStream(args[0]).getChannel(),
               out = new FileOutputStream(args[1]).getChannel();

    in.transferTo(0, 4096, out);
  }
}
---------------------------------------------



Petr




Bug reassigned from package 'gij' to 'gcj-4.4'. Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Fri, 09 Apr 2010 09:33:13 GMT) Full text and rfc822 format available.

Bug No longer marked as found in versions gcc-defaults/1.92. Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Fri, 09 Apr 2010 09:33:14 GMT) Full text and rfc822 format available.

Changed Bug title to 'gcj-4.4: FileChannel.transferTo() does not conform to java specification (gij: Bus error when executing ant)' from 'gij: Bus error when executing ant' Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Fri, 09 Apr 2010 09:33:14 GMT) Full text and rfc822 format available.

Removed tag(s) moreinfo. Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Fri, 09 Apr 2010 09:33:15 GMT) Full text and rfc822 format available.

Removed tag(s) help. Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Fri, 09 Apr 2010 09:33:16 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#571532; Package gcj-4.4. (Fri, 09 Apr 2010 10:03:11 GMT) Full text and rfc822 format available.

Acknowledgement sent to Petr Salinger <Petr.Salinger@seznam.cz>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. (Fri, 09 Apr 2010 10:03:11 GMT) Full text and rfc822 format available.

Message #105 received at 571532@bugs.debian.org (full text, mbox):

From: Petr Salinger <Petr.Salinger@seznam.cz>
To: 571532@bugs.debian.org
Cc: control@bugs.debian.org
Subject: gcj-4.4: FileChannel.transferTo() does not conform to java specification (gij: Bus error when executing ant)
Date: Fri, 9 Apr 2010 13:32:53 +0200 (CEST)
reassign 571532 gcj-4.4
retitle  571532 gcj-4.4: FileChannel.transferTo() does not conform to java specification (gij: Bus error when executing ant)
tags 571532 - moreinfo
tags 571532 - help
thanks

I believe that all needed info have been already provided
in Message #85 and Message #90.

Petr




Set Bug forwarded-to-address to 'http://gcc.gnu.org/PR43717'. Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Tue, 13 Apr 2010 07:12:09 GMT) Full text and rfc822 format available.

Added tag(s) upstream. Request was from Petr Salinger <Petr.Salinger@seznam.cz> to control@bugs.debian.org. (Tue, 13 Apr 2010 07:12:09 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 06:40:24 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.