Compare commits
No commits in common. "c9-beta-stream-3.8" and "c8-stream-3.6" have entirely different histories.
c9-beta-st
...
c8-stream-
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
SOURCES/maven-shared-utils-3.3.4-source-release.zip
|
SOURCES/maven-shared-utils-3.2.1-source-release.zip
|
||||||
|
@ -1 +1 @@
|
|||||||
56437c40076ab4057fe535bd6a60ef905878eba7 SOURCES/maven-shared-utils-3.3.4-source-release.zip
|
015559e466938c7e9053603d37b96ef3e03b802b SOURCES/maven-shared-utils-3.2.1-source-release.zip
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
From 0466ed821db9af6ad856b011566148b3ad0d0267 Mon Sep 17 00:00:00 2001
|
From e3d2a29743e1b36beaf1063567da9dfd2e5a8aa8 Mon Sep 17 00:00:00 2001
|
||||||
From: Michael Simacek <msimacek@redhat.com>
|
From: Michael Simacek <msimacek@redhat.com>
|
||||||
Date: Mon, 26 Feb 2018 16:21:04 +0100
|
Date: Mon, 26 Feb 2018 16:21:04 +0100
|
||||||
Subject: [PATCH 1/3] Restore compatibility with current maven
|
Subject: [PATCH] Restore compatibility with current maven
|
||||||
|
|
||||||
---
|
---
|
||||||
.../utils/logging/AnsiMessageBuilder.java | 18 ++++++++++++++++++
|
.../maven/shared/utils/logging/AnsiMessageBuilder.java | 18 ++++++++++++++++++
|
||||||
.../shared/utils/logging/MessageBuilder.java | 3 +++
|
.../maven/shared/utils/logging/MessageBuilder.java | 3 +++
|
||||||
.../utils/logging/PlainMessageBuilder.java | 18 ++++++++++++++++++
|
.../shared/utils/logging/PlainMessageBuilder.java | 18 ++++++++++++++++++
|
||||||
3 files changed, 39 insertions(+)
|
3 files changed, 39 insertions(+)
|
||||||
|
|
||||||
diff --git a/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java b/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java
|
diff --git a/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java b/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java
|
||||||
index 2d59bc9..77c93ae 100644
|
index 0103a6b..23b6d14 100644
|
||||||
--- a/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java
|
--- a/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java
|
||||||
+++ b/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java
|
+++ b/src/main/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilder.java
|
||||||
@@ -153,4 +153,22 @@ class AnsiMessageBuilder
|
@@ -153,4 +153,22 @@ class AnsiMessageBuilder
|
||||||
@ -37,7 +37,7 @@ index 2d59bc9..77c93ae 100644
|
|||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java b/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java
|
diff --git a/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java b/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java
|
||||||
index 060e824..a3b3025 100644
|
index b60bb4e..1dc2624 100644
|
||||||
--- a/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java
|
--- a/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java
|
||||||
+++ b/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java
|
+++ b/src/main/java/org/apache/maven/shared/utils/logging/MessageBuilder.java
|
||||||
@@ -26,6 +26,9 @@ package org.apache.maven.shared.utils.logging;
|
@@ -26,6 +26,9 @@ package org.apache.maven.shared.utils.logging;
|
||||||
@ -51,7 +51,7 @@ index 060e824..a3b3025 100644
|
|||||||
* Append message content in success style.
|
* Append message content in success style.
|
||||||
* By default, bold green
|
* By default, bold green
|
||||||
diff --git a/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java b/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java
|
diff --git a/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java b/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java
|
||||||
index 6a7b56e..1a5889a 100644
|
index 2eec001..5236e99 100644
|
||||||
--- a/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java
|
--- a/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java
|
||||||
+++ b/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java
|
+++ b/src/main/java/org/apache/maven/shared/utils/logging/PlainMessageBuilder.java
|
||||||
@@ -139,4 +139,22 @@ class PlainMessageBuilder
|
@@ -139,4 +139,22 @@ class PlainMessageBuilder
|
||||||
@ -78,5 +78,5 @@ index 6a7b56e..1a5889a 100644
|
|||||||
+ }
|
+ }
|
||||||
}
|
}
|
||||||
--
|
--
|
||||||
2.26.2
|
2.14.3
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
From 932f9b15bd62255f81c66b564f748fff6ec84c86 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
|
||||||
Date: Thu, 24 Sep 2020 20:17:56 +0200
|
|
||||||
Subject: [PATCH 3/3] Avoid setting POSIX attributes for symbolic links
|
|
||||||
|
|
||||||
---
|
|
||||||
src/main/java/org/apache/maven/shared/utils/io/FileUtils.java | 4 ++--
|
|
||||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java b/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java
|
|
||||||
index a3be324..a396d99 100644
|
|
||||||
--- a/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java
|
|
||||||
+++ b/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java
|
|
||||||
@@ -1973,9 +1973,9 @@ public class FileUtils
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- }
|
|
||||||
|
|
||||||
- copyFilePermissions( from, to );
|
|
||||||
+ copyFilePermissions( from, to );
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
--
|
|
||||||
2.26.2
|
|
||||||
|
|
79
SOURCES/0002-Port-to-hamcrest-2.1.patch
Normal file
79
SOURCES/0002-Port-to-hamcrest-2.1.patch
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
From 613f27fe7ff4a89c21689a16f6f6b9b3e0b7c347 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marian Koncek <mkoncek@redhat.com>
|
||||||
|
Date: Thu, 29 Aug 2019 15:04:46 +0200
|
||||||
|
Subject: [PATCH] Port to hamcrest 2.1
|
||||||
|
|
||||||
|
---
|
||||||
|
.../shared/utils/reflection/ReflectorTest.java | 14 +++++++-------
|
||||||
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java b/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java
|
||||||
|
index 0088361..09f6048 100644
|
||||||
|
--- a/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java
|
||||||
|
+++ b/src/test/java/org/apache/maven/shared/utils/reflection/ReflectorTest.java
|
||||||
|
@@ -50,7 +50,7 @@ public class ReflectorTest
|
||||||
|
public void newInstanceClassNull()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.newInstance( Object.class, null ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.newInstance( Object.class, null ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = NullPointerException.class )
|
||||||
|
@@ -64,7 +64,7 @@ public class ReflectorTest
|
||||||
|
public void newInstanceClassEmptyArray()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.newInstance( Object.class, new Object[0] ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.newInstance( Object.class, new Object[0] ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = ReflectorException.class )
|
||||||
|
@@ -156,7 +156,7 @@ public class ReflectorTest
|
||||||
|
public void getSingletonClassNull()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.getSingleton( (Class<?>)Object.class, (Object)null ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.getSingleton( (Class<?>)Object.class, (Object)null ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = NullPointerException.class )
|
||||||
|
@@ -170,7 +170,7 @@ public class ReflectorTest
|
||||||
|
public void getSingletonClassEmptyArray()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.getSingleton( Object.class, new Object[0] ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.getSingleton( Object.class, new Object[0] ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = ReflectorException.class )
|
||||||
|
@@ -787,7 +787,7 @@ public class ReflectorTest
|
||||||
|
public void invokeStaticClassNullNull()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.invokeStatic( Object.class, (String)null, (Object)null ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.invokeStatic( Object.class, (String)null, (Object)null ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = NullPointerException.class )
|
||||||
|
@@ -801,7 +801,7 @@ public class ReflectorTest
|
||||||
|
public void invokeStaticClassNullEmptyArray()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.invokeStatic( Object.class, null, new Object[0] ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.invokeStatic( Object.class, null, new Object[0] ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = NullPointerException.class )
|
||||||
|
@@ -829,7 +829,7 @@ public class ReflectorTest
|
||||||
|
public void invokeStaticClassEmptyEmptyArray()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
- assertThat( reflector.invokeStatic( Object.class, "", new Object[0] ), is( Object.class ) );
|
||||||
|
+ assertThat( reflector.invokeStatic( Object.class, "", new Object[0] ), isA( Object.class ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test( expected = IllegalArgumentException.class )
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
@ -0,0 +1,319 @@
|
|||||||
|
From c0b225b90d1056e29d681258a2008ae8aff2b508 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Marian Koncek <mkoncek@redhat.com>
|
||||||
|
Date: Tue, 5 Apr 2022 13:56:20 +0200
|
||||||
|
Subject: [PATCH] Unconditionally single quote executable and arguments
|
||||||
|
|
||||||
|
Upstream: https://github.com/apache/maven-shared-utils/pull/40/commits
|
||||||
|
---
|
||||||
|
.../shared/utils/cli/shell/BourneShell.java | 48 ++++++++-----------
|
||||||
|
.../maven/shared/utils/cli/shell/Shell.java | 39 ++++++++++-----
|
||||||
|
.../utils/cli/shell/BourneShellTest.java | 35 ++++++++++----
|
||||||
|
3 files changed, 72 insertions(+), 50 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/apache/maven/shared/utils/cli/shell/BourneShell.java b/src/main/java/org/apache/maven/shared/utils/cli/shell/BourneShell.java
|
||||||
|
index 11a447a..f0de631 100644
|
||||||
|
--- a/src/main/java/org/apache/maven/shared/utils/cli/shell/BourneShell.java
|
||||||
|
+++ b/src/main/java/org/apache/maven/shared/utils/cli/shell/BourneShell.java
|
||||||
|
@@ -23,7 +23,6 @@ package org.apache.maven.shared.utils.cli.shell;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.maven.shared.utils.Os;
|
||||||
|
-import org.apache.maven.shared.utils.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Jason van Zyl
|
||||||
|
@@ -31,17 +30,15 @@ import org.apache.maven.shared.utils.StringUtils;
|
||||||
|
public class BourneShell
|
||||||
|
extends Shell
|
||||||
|
{
|
||||||
|
- private static final char[] BASH_QUOTING_TRIGGER_CHARS =
|
||||||
|
- { ' ', '$', ';', '&', '|', '<', '>', '*', '?', '(', ')', '[', ']', '{', '}', '`' };
|
||||||
|
-
|
||||||
|
/**
|
||||||
|
- * Create instance of BournShell.
|
||||||
|
+ * Create instance of BourneShell.
|
||||||
|
*/
|
||||||
|
public BourneShell()
|
||||||
|
{
|
||||||
|
+ setUnconditionalQuoting( true );
|
||||||
|
setShellCommand( "/bin/sh" );
|
||||||
|
setArgumentQuoteDelimiter( '\'' );
|
||||||
|
- setExecutableQuoteDelimiter( '\"' );
|
||||||
|
+ setExecutableQuoteDelimiter( '\'' );
|
||||||
|
setSingleQuotedArgumentEscaped( true );
|
||||||
|
setSingleQuotedExecutableEscaped( false );
|
||||||
|
setQuotedExecutableEnabled( true );
|
||||||
|
@@ -57,7 +54,7 @@ public class BourneShell
|
||||||
|
return super.getExecutable();
|
||||||
|
}
|
||||||
|
|
||||||
|
- return unifyQuotes( super.getExecutable() );
|
||||||
|
+ return quoteOneItem( super.getExecutable(), true );
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@@ -110,47 +107,40 @@ public class BourneShell
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append( "cd " );
|
||||||
|
|
||||||
|
- sb.append( unifyQuotes( dir ) );
|
||||||
|
+ sb.append( quoteOneItem( dir, false ) );
|
||||||
|
sb.append( " && " );
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
- /** {@inheritDoc} */
|
||||||
|
- protected char[] getQuotingTriggerChars()
|
||||||
|
- {
|
||||||
|
- return BASH_QUOTING_TRIGGER_CHARS;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
/**
|
||||||
|
* <p>Unify quotes in a path for the Bourne Shell.</p>
|
||||||
|
* <p/>
|
||||||
|
* <pre>
|
||||||
|
- * BourneShell.unifyQuotes(null) = null
|
||||||
|
- * BourneShell.unifyQuotes("") = (empty)
|
||||||
|
- * BourneShell.unifyQuotes("/test/quotedpath'abc") = /test/quotedpath\'abc
|
||||||
|
- * BourneShell.unifyQuotes("/test/quoted path'abc") = "/test/quoted path'abc"
|
||||||
|
- * BourneShell.unifyQuotes("/test/quotedpath\"abc") = "/test/quotedpath\"abc"
|
||||||
|
- * BourneShell.unifyQuotes("/test/quoted path\"abc") = "/test/quoted path\"abc"
|
||||||
|
- * BourneShell.unifyQuotes("/test/quotedpath\"'abc") = "/test/quotedpath\"'abc"
|
||||||
|
- * BourneShell.unifyQuotes("/test/quoted path\"'abc") = "/test/quoted path\"'abc"
|
||||||
|
+ * BourneShell.quoteOneItem(null) = null
|
||||||
|
+ * BourneShell.quoteOneItem("") = ''
|
||||||
|
+ * BourneShell.quoteOneItem("/test/quotedpath'abc") = '/test/quotedpath'"'"'abc'
|
||||||
|
+ * BourneShell.quoteOneItem("/test/quoted path'abc") = '/test/quoted pat'"'"'habc'
|
||||||
|
+ * BourneShell.quoteOneItem("/test/quotedpath\"abc") = '/test/quotedpath"abc'
|
||||||
|
+ * BourneShell.quoteOneItem("/test/quoted path\"abc") = '/test/quoted path"abc'
|
||||||
|
+ * BourneShell.quoteOneItem("/test/quotedpath\"'abc") = '/test/quotedpath"'"'"'abc'
|
||||||
|
+ * BourneShell.quoteOneItem("/test/quoted path\"'abc") = '/test/quoted path"'"'"'abc'
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @param path not null path.
|
||||||
|
* @return the path unified correctly for the Bourne shell.
|
||||||
|
*/
|
||||||
|
- private static String unifyQuotes( String path )
|
||||||
|
+ protected String quoteOneItem( String path, boolean isExecutable )
|
||||||
|
{
|
||||||
|
if ( path == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if ( path.indexOf( ' ' ) == -1 && path.indexOf( '\'' ) != -1 && path.indexOf( '"' ) == -1 )
|
||||||
|
- {
|
||||||
|
- return StringUtils.escape( path );
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return StringUtils.quoteAndEscape( path, '\"', BASH_QUOTING_TRIGGER_CHARS );
|
||||||
|
+ StringBuilder sb = new StringBuilder();
|
||||||
|
+ sb.append( "'" );
|
||||||
|
+ sb.append( path.replace( "'", "'\"'\"'" ) );
|
||||||
|
+ sb.append( "'" );
|
||||||
|
+ return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/apache/maven/shared/utils/cli/shell/Shell.java b/src/main/java/org/apache/maven/shared/utils/cli/shell/Shell.java
|
||||||
|
index 6fa2f73..96904cb 100644
|
||||||
|
--- a/src/main/java/org/apache/maven/shared/utils/cli/shell/Shell.java
|
||||||
|
+++ b/src/main/java/org/apache/maven/shared/utils/cli/shell/Shell.java
|
||||||
|
@@ -50,6 +50,8 @@ public class Shell
|
||||||
|
|
||||||
|
private boolean quotedArgumentsEnabled = true;
|
||||||
|
|
||||||
|
+ private boolean unconditionalQuoting = false;
|
||||||
|
+
|
||||||
|
private String executable;
|
||||||
|
|
||||||
|
private String workingDir;
|
||||||
|
@@ -113,6 +115,19 @@ public class Shell
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ protected String quoteOneItem( String inputString, boolean isExecutable )
|
||||||
|
+ {
|
||||||
|
+ char[] escapeChars = getEscapeChars( isSingleQuotedExecutableEscaped(), isDoubleQuotedExecutableEscaped() );
|
||||||
|
+ return StringUtils.quoteAndEscape(
|
||||||
|
+ inputString,
|
||||||
|
+ isExecutable ? getExecutableQuoteDelimiter() : getArgumentQuoteDelimiter(),
|
||||||
|
+ escapeChars,
|
||||||
|
+ getQuotingTriggerChars(),
|
||||||
|
+ '\\',
|
||||||
|
+ unconditionalQuoting
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Get the command line for the provided executable and arguments in this shell
|
||||||
|
*
|
||||||
|
@@ -145,15 +160,11 @@ public class Shell
|
||||||
|
|
||||||
|
if ( isQuotedExecutableEnabled() )
|
||||||
|
{
|
||||||
|
- char[] escapeChars =
|
||||||
|
- getEscapeChars( isSingleQuotedExecutableEscaped(), isDoubleQuotedExecutableEscaped() );
|
||||||
|
-
|
||||||
|
- sb.append( StringUtils.quoteAndEscape( getExecutable(), getExecutableQuoteDelimiter(), escapeChars,
|
||||||
|
- getQuotingTriggerChars(), '\\', false ) );
|
||||||
|
+ sb.append( quoteOneItem( executableParameter, true ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- sb.append( getExecutable() );
|
||||||
|
+ sb.append( executableParameter );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for ( String argument : argumentsParameter )
|
||||||
|
@@ -165,10 +176,7 @@ public class Shell
|
||||||
|
|
||||||
|
if ( isQuotedArgumentsEnabled() )
|
||||||
|
{
|
||||||
|
- char[] escapeChars = getEscapeChars( isSingleQuotedArgumentEscaped(), isDoubleQuotedArgumentEscaped() );
|
||||||
|
-
|
||||||
|
- sb.append( StringUtils.quoteAndEscape( argument, getArgumentQuoteDelimiter(), escapeChars,
|
||||||
|
- getQuotingTriggerChars(), '\\', false ) );
|
||||||
|
+ sb.append( quoteOneItem( argument, false ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@@ -285,7 +293,7 @@ public class Shell
|
||||||
|
commandLine.addAll( getShellArgsList() );
|
||||||
|
}
|
||||||
|
|
||||||
|
- commandLine.addAll( getCommandLine( getExecutable(), arguments ) );
|
||||||
|
+ commandLine.addAll( getCommandLine( executable, arguments ) );
|
||||||
|
|
||||||
|
return commandLine;
|
||||||
|
|
||||||
|
@@ -398,4 +406,13 @@ public class Shell
|
||||||
|
this.singleQuotedExecutableEscaped = singleQuotedExecutableEscaped;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public boolean isUnconditionalQuoting()
|
||||||
|
+ {
|
||||||
|
+ return unconditionalQuoting;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setUnconditionalQuoting( boolean unconditionalQuoting )
|
||||||
|
+ {
|
||||||
|
+ this.unconditionalQuoting = unconditionalQuoting;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
diff --git a/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java b/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java
|
||||||
|
index b5f23d9..f5143c1 100644
|
||||||
|
--- a/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java
|
||||||
|
+++ b/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java
|
||||||
|
@@ -44,7 +44,7 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
String executable = StringUtils.join( sh.getShellCommandLine( new String[]{} ).iterator(), " " );
|
||||||
|
|
||||||
|
- assertEquals( "/bin/sh -c cd /usr/local/bin && chmod", executable );
|
||||||
|
+ assertEquals( "/bin/sh -c cd '/usr/local/bin' && 'chmod'", executable );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes()
|
||||||
|
@@ -56,7 +56,7 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
String executable = StringUtils.join( sh.getShellCommandLine( new String[]{} ).iterator(), " " );
|
||||||
|
|
||||||
|
- assertEquals( "/bin/sh -c cd \"/usr/local/\'something else\'\" && chmod", executable );
|
||||||
|
+ assertEquals( "/bin/sh -c cd '/usr/local/'\"'\"'something else'\"'\"'' && 'chmod'", executable );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes_BackslashFileSep()
|
||||||
|
@@ -68,7 +68,7 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
String executable = StringUtils.join( sh.getShellCommandLine( new String[]{} ).iterator(), " " );
|
||||||
|
|
||||||
|
- assertEquals( "/bin/sh -c cd \"\\usr\\local\\\'something else\'\" && chmod", executable );
|
||||||
|
+ assertEquals( "/bin/sh -c cd '\\usr\\local\\'\"'\"'something else'\"'\"'' && 'chmod'", executable );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testPreserveSingleQuotesOnArgument()
|
||||||
|
@@ -78,13 +78,13 @@ public class BourneShellTest
|
||||||
|
sh.setWorkingDirectory( "/usr/bin" );
|
||||||
|
sh.setExecutable( "chmod" );
|
||||||
|
|
||||||
|
- String[] args = { "\'some arg with spaces\'" };
|
||||||
|
+ String[] args = { "\"some arg with spaces\"" };
|
||||||
|
|
||||||
|
List<String> shellCommandLine = sh.getShellCommandLine( args );
|
||||||
|
|
||||||
|
String cli = StringUtils.join( shellCommandLine.iterator(), " " );
|
||||||
|
System.out.println( cli );
|
||||||
|
- assertTrue( cli.endsWith( args[0] ) );
|
||||||
|
+ assertTrue( cli.endsWith( "'\"some arg with spaces\"'" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAddSingleQuotesOnArgumentWithSpaces()
|
||||||
|
@@ -100,7 +100,21 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
String cli = StringUtils.join( shellCommandLine.iterator(), " " );
|
||||||
|
System.out.println( cli );
|
||||||
|
- assertTrue( cli.endsWith( "\'" + args[0] + "\'" ) );
|
||||||
|
+ assertTrue( cli.endsWith("'some arg with spaces'"));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void testAddArgumentWithSingleQuote()
|
||||||
|
+ {
|
||||||
|
+ Shell sh = newShell();
|
||||||
|
+
|
||||||
|
+ sh.setWorkingDirectory( "/usr/bin" );
|
||||||
|
+ sh.setExecutable( "chmod" );
|
||||||
|
+
|
||||||
|
+ String[] args = { "arg'withquote" };
|
||||||
|
+
|
||||||
|
+ List<String> shellCommandLine = sh.getShellCommandLine( args );
|
||||||
|
+
|
||||||
|
+ assertEquals("cd '/usr/bin' && 'chmod' 'arg'\"'\"'withquote'", shellCommandLine.get(shellCommandLine.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testArgumentsWithsemicolon()
|
||||||
|
@@ -119,7 +133,7 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
String cli = StringUtils.join( shellCommandLine.iterator(), " " );
|
||||||
|
System.out.println( cli );
|
||||||
|
- assertTrue( cli.endsWith( "\'" + args[0] + "\'" ) );
|
||||||
|
+ assertTrue( cli.endsWith( "';some&argwithunix$chars'" ) );
|
||||||
|
|
||||||
|
Commandline commandline = new Commandline( newShell() );
|
||||||
|
commandline.setExecutable( "chmod" );
|
||||||
|
@@ -132,7 +146,7 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
assertEquals( "/bin/sh", lines.get( 0 ) );
|
||||||
|
assertEquals( "-c", lines.get( 1 ) );
|
||||||
|
- assertEquals( "chmod --password ';password'", lines.get( 2 ) );
|
||||||
|
+ assertEquals( "'chmod' '--password' ';password'", lines.get( 2 ) );
|
||||||
|
|
||||||
|
commandline = new Commandline( newShell() );
|
||||||
|
commandline.setExecutable( "chmod" );
|
||||||
|
@@ -144,7 +158,7 @@ public class BourneShellTest
|
||||||
|
|
||||||
|
assertEquals( "/bin/sh", lines.get( 0) );
|
||||||
|
assertEquals( "-c", lines.get( 1 ) );
|
||||||
|
- assertEquals( "chmod --password ';password'", lines.get( 2 ) );
|
||||||
|
+ assertEquals( "'chmod' '--password' ';password'", lines.get( 2 ) );
|
||||||
|
|
||||||
|
commandline = new Commandline( new CmdShell() );
|
||||||
|
commandline.getShell().setQuotedArgumentsEnabled( true );
|
||||||
|
@@ -186,13 +200,14 @@ public class BourneShellTest
|
||||||
|
commandline.createArg().setValue( "{" );
|
||||||
|
commandline.createArg().setValue( "}" );
|
||||||
|
commandline.createArg().setValue( "`" );
|
||||||
|
+ commandline.createArg().setValue( "#" );
|
||||||
|
|
||||||
|
List<String> lines = commandline.getShell().getShellCommandLine( commandline.getArguments() );
|
||||||
|
System.out.println( lines );
|
||||||
|
|
||||||
|
assertEquals( "/bin/sh", lines.get( 0 ) );
|
||||||
|
assertEquals( "-c", lines.get( 1 ) );
|
||||||
|
- assertEquals( "chmod ' ' '|' '&&' '||' ';' ';;' '&' '()' '<' '<<' '>' '>>' '*' '?' '[' ']' '{' '}' '`'",
|
||||||
|
+ assertEquals( "'chmod' ' ' '|' '&&' '||' ';' ';;' '&' '()' '<' '<<' '>' '>>' '*' '?' '[' ']' '{' '}' '`' '#'",
|
||||||
|
lines.get( 2 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
@ -1,22 +1,18 @@
|
|||||||
%bcond_with bootstrap
|
|
||||||
|
|
||||||
Name: maven-shared-utils
|
Name: maven-shared-utils
|
||||||
Version: 3.3.4
|
Version: 3.2.1
|
||||||
Release: 6%{?dist}
|
Release: 0.5%{?dist}
|
||||||
Summary: Maven shared utility classes
|
Summary: Maven shared utility classes
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
URL: https://maven.apache.org/shared/maven-shared-utils
|
URL: http://maven.apache.org/shared/maven-shared-utils
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
ExclusiveArch: %{java_arches} noarch
|
|
||||||
|
|
||||||
Source0: https://repo1.maven.org/maven2/org/apache/maven/shared/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
Source0: http://repo1.maven.org/maven2/org/apache/maven/shared/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
||||||
# XXX temporary for maven upgrade
|
# XXX temporary for maven upgrade
|
||||||
Patch1: 0001-Restore-compatibility-with-current-maven.patch
|
Patch1: 0001-Restore-compatibility-with-current-maven.patch
|
||||||
Patch2: 0002-Avoid-setting-POSIX-attributes-for-symbolic-links.patch
|
|
||||||
|
|
||||||
%if %{with bootstrap}
|
Patch2: 0002-Port-to-hamcrest-2.1.patch
|
||||||
BuildRequires: javapackages-bootstrap-openjdk8
|
Patch3: 0003-Unconditionally-single-quote-executable-and-argument.patch
|
||||||
%else
|
|
||||||
BuildRequires: maven-local-openjdk8
|
BuildRequires: maven-local-openjdk8
|
||||||
BuildRequires: mvn(com.google.code.findbugs:jsr305)
|
BuildRequires: mvn(com.google.code.findbugs:jsr305)
|
||||||
BuildRequires: %{?module_prefix}mvn(commons-io:commons-io)
|
BuildRequires: %{?module_prefix}mvn(commons-io:commons-io)
|
||||||
@ -28,7 +24,6 @@ BuildRequires: mvn(org.apache.maven.shared:maven-shared-components:pom:)
|
|||||||
BuildRequires: mvn(org.codehaus.plexus:plexus-container-default)
|
BuildRequires: mvn(org.codehaus.plexus:plexus-container-default)
|
||||||
BuildRequires: mvn(org.fusesource.jansi:jansi)
|
BuildRequires: mvn(org.fusesource.jansi:jansi)
|
||||||
BuildRequires: mvn(org.hamcrest:hamcrest-core)
|
BuildRequires: mvn(org.hamcrest:hamcrest-core)
|
||||||
%endif
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This project aims to be a functional replacement for plexus-utils in Maven.
|
This project aims to be a functional replacement for plexus-utils in Maven.
|
||||||
@ -37,67 +32,31 @@ It is not a 100% API compatible replacement though but a replacement with
|
|||||||
improvements: lots of methods got cleaned up, generics got added and we dropped
|
improvements: lots of methods got cleaned up, generics got added and we dropped
|
||||||
a lot of unused code.
|
a lot of unused code.
|
||||||
|
|
||||||
|
%{?module_package}
|
||||||
%{?javadoc_package}
|
%{?javadoc_package}
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
find -name '*.java' -exec sed -i 's/\r//' {} +
|
|
||||||
|
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
|
||||||
%pom_remove_plugin org.codehaus.mojo:findbugs-maven-plugin
|
%pom_remove_plugin org.codehaus.mojo:findbugs-maven-plugin
|
||||||
|
|
||||||
%pom_remove_dep org.apache.commons:commons-text
|
|
||||||
rm src/test/java/org/apache/maven/shared/utils/CaseTest.java
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%mvn_build
|
%mvn_build
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%mvn_install
|
%mvn_install
|
||||||
|
|
||||||
%files -f .mfiles
|
%files -n %{?module_prefix}%{name} -f .mfiles
|
||||||
%license LICENSE NOTICE
|
%license LICENSE NOTICE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Mon Feb 05 2024 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.3.4-6
|
* Tue Apr 05 2022 Marián Konček <mkoncek@redhat.com> - 3.2.1-0.5
|
||||||
- Rebuild to regenerate auto-requires
|
- Fix commandline injection vulnerability
|
||||||
|
- Resolves: CVE-2022-29599
|
||||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.4-5
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
|
||||||
|
|
||||||
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 3.3.4-4
|
|
||||||
- Rebuilt for java-17-openjdk as system jdk
|
|
||||||
|
|
||||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.4-3
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
|
||||||
|
|
||||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.4-2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Jun 25 2021 Marian Koncek <mkoncek@redhat.com> - 3.3.4-1
|
|
||||||
- Update to upstream version 3.3.4
|
|
||||||
|
|
||||||
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.3.3-2
|
|
||||||
- Bootstrap build
|
|
||||||
- Non-bootstrap build
|
|
||||||
|
|
||||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-0.8
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Sep 11 2020 Marian Koncek <mkoncek@redhat.com> - 3.3.3-1
|
|
||||||
- Update to upstream version 3.3.3
|
|
||||||
|
|
||||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-0.7
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 3.2.1-0.6
|
|
||||||
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
|
|
||||||
|
|
||||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-0.5
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
|
||||||
|
|
||||||
* Sat Jan 25 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.1-0.4
|
* Sat Jan 25 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.1-0.4
|
||||||
- Build with OpenJDK 8
|
- Build with OpenJDK 8
|
||||||
@ -105,18 +64,9 @@ rm src/test/java/org/apache/maven/shared/utils/CaseTest.java
|
|||||||
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.1-0.3
|
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.1-0.3
|
||||||
- Mass rebuild for javapackages-tools 201902
|
- Mass rebuild for javapackages-tools 201902
|
||||||
|
|
||||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-0.4
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.1-0.2
|
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.2.1-0.2
|
||||||
- Mass rebuild for javapackages-tools 201901
|
- Mass rebuild for javapackages-tools 201901
|
||||||
|
|
||||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-0.3
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
|
||||||
|
|
||||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.1-0.2
|
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
|
||||||
|
|
||||||
* Mon Feb 26 2018 Michael Simacek <msimacek@redhat.com> - 3.2.1-0.1
|
* Mon Feb 26 2018 Michael Simacek <msimacek@redhat.com> - 3.2.1-0.1
|
||||||
- Update to upstream version 3.2.1 (patched temporary)
|
- Update to upstream version 3.2.1 (patched temporary)
|
||||||
|
|
||||||
@ -207,3 +157,4 @@ rm src/test/java/org/apache/maven/shared/utils/CaseTest.java
|
|||||||
|
|
||||||
* Wed Jan 16 2013 Tomas Radej <tradej@redhat.com> - 0.2-1
|
* Wed Jan 16 2013 Tomas Radej <tradej@redhat.com> - 0.2-1
|
||||||
- Initial version
|
- Initial version
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user