From 22ef1323cc2e38505dcfde911939cd92b6539dd5 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sat, 26 Nov 2022 17:23:20 +0100 Subject: [PATCH] warn against multi-byte encoding in tar --- manual/Tasks/tar.html | 5 ++++- src/etc/testcases/taskdefs/untar.xml | 8 ++++++++ .../junit/org/apache/tools/ant/taskdefs/UntarTest.java | 8 ++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/manual/Tasks/tar.html b/manual/Tasks/tar.html index 88d3c3a73..985625b32 100644 --- a/manual/Tasks/tar.html +++ b/manual/Tasks/tar.html @@ -133,7 +133,10 @@ to gzip, bzip2, or xz.

The character encoding to use for filenames inside the tar file. For a list of possible values see the Supported Encodings.
Since Ant 1.9.5 + target="_top">Supported Encodings. In general the tar format + expects names to use a single byte encoding and specifying a + multi-byte encoding here may lead to archives that cannot be + properly extracted by my tar tools.
Since Ant 1.9.5 No; defaults to default JVM character encoding diff --git a/src/etc/testcases/taskdefs/untar.xml b/src/etc/testcases/taskdefs/untar.xml index a443e120d..1255d9d87 100644 --- a/src/etc/testcases/taskdefs/untar.xml +++ b/src/etc/testcases/taskdefs/untar.xml @@ -58,6 +58,14 @@ + + + + + + + + diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java index 6a1cca457..4f414f877 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/UntarTest.java @@ -85,6 +85,14 @@ public class UntarTest { buildRule.getProject().resolveFile(filename).exists()); } + @Test + public void testMultiByteEncoding() { + buildRule.executeTarget("multiByteEncodingTest"); + String filename = buildRule.getProject().getProperty("output") + "/untartestout/foo"; + assertTrue("foo has been properly named", + buildRule.getProject().resolveFile(filename).exists()); + } + @Test public void testResourceCollection() throws IOException { testLogoExtraction("resourceCollection");