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

Petr Salinger Petr.Salinger at seznam.cz
Tue Mar 9 11:33:36 UTC 2010


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 {






More information about the pkg-java-maintainers mailing list