[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#571532: [patch] ant FTBFS on gcj architectures



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 {




Reply to: