You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2023/06/06 18:26:56 UTC

[maven-file-management] branch revert1 updated (da16254 -> 5bd91dd)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch revert1
in repository https://gitbox.apache.org/repos/asf/maven-file-management.git


 discard da16254  Revert "MSHARED-1203 use Java 7 symbolic links (#13)"
     new 5bd91dd  Revert "MSHARED-1203 use Java 7 symbolic links (#13)"

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (da16254)
            \
             N -- N -- N   refs/heads/revert1 (5bd91dd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../model/fileset/util/FileSetUtilsTest.java       | 24 ++++------------------
 1 file changed, 4 insertions(+), 20 deletions(-)


[maven-file-management] 01/01: Revert "MSHARED-1203 use Java 7 symbolic links (#13)"

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch revert1
in repository https://gitbox.apache.org/repos/asf/maven-file-management.git

commit 5bd91dd78e6f64fd065a6630ef639adefc1818a3
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Tue Jun 6 20:18:13 2023 +0200

    Revert "MSHARED-1203 use Java 7 symbolic links (#13)"
    
    This reverts commit 3a1e97dcb11d3bb8754a9f1d905f6f5ebbdf3da3.
---
 .../model/fileset/util/FileSetUtilsTest.java       | 50 ++++++++++++----------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java b/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
index bf2054a..131da51 100644
--- a/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
@@ -22,14 +22,14 @@ import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLDecoder;
-import java.nio.file.Files;
 import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.shared.model.fileset.FileSet;
+import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.cli.Commandline;
 import org.junit.After;
-import org.junit.Assume;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -76,16 +76,14 @@ public class FileSetUtilsTest {
     }
 
     @Test
-    public void testIncludesDontFollowSymlinks() throws IOException {
+    public void testIncludesDontFollowSymlinks() throws IOException, InterruptedException, CommandLineException {
         File directory = setupTestDirectory("testIncludesDontFollowSymlinks");
         File subdir = new File(directory, directory.getName());
 
-        try {
-            createSymlink(directory, subdir);
-        } catch (UnsupportedOperationException | SecurityException ex) {
-            // failed to create a sym link is because the system does not support them
+        if (!createSymlink(directory, subdir)) {
+            // assume failure to create a sym link is because the system does not support them
             // and not because the sym link creation failed.
-            Assume.assumeFalse(true);
+            return;
         }
 
         FileSet set = new FileSet();
@@ -101,16 +99,14 @@ public class FileSetUtilsTest {
     }
 
     @Test
-    public void testDeleteDontFollowSymlinks() throws IOException {
+    public void testDeleteDontFollowSymlinks() throws IOException, InterruptedException, CommandLineException {
         File directory = setupTestDirectory("testDeleteDontFollowSymlinks");
         File subdir = new File(directory, directory.getName());
 
-        try {
-            createSymlink(directory, subdir);
-        } catch (UnsupportedOperationException | SecurityException ex) {
-            // failed to create a sym link is because the system does not support them
+        if (!createSymlink(directory, subdir)) {
+            // assume failure to create a sym link is because the system does not support them
             // and not because the sym link creation failed.
-            Assume.assumeFalse(true);
+            return;
         }
 
         FileSet set = new FileSet();
@@ -155,12 +151,9 @@ public class FileSetUtilsTest {
         File targetFile = new File(directory, "test.txt");
         File linkFile = new File(directory, "symlink");
 
-        try {
-            createSymlink(targetFile, linkFile);
-        } catch (UnsupportedOperationException | SecurityException ex) {
-            // failed to create a sym link is because the system does not support them
-            // and not because the sym link creation failed.
-            Assume.assumeFalse(true);
+        if (!createSymlink(targetFile, linkFile)) {
+            // symlinks apparently not supported, skip test
+            return;
         }
         targetFile.delete();
 
@@ -256,7 +249,7 @@ public class FileSetUtilsTest {
     }
 
     @Test
-    public void testDeleteDontFollowSymlinksButDeleteThem() throws IOException {
+    public void testDeleteDontFollowSymlinksButDeleteThem() throws Exception {
         File directory = setupTestDirectory("testDeleteDontFollowSymlinksButDeleteThem");
 
         createSymlink(new File(directory, "excluded"), new File(directory, "dirlink"));
@@ -281,12 +274,23 @@ public class FileSetUtilsTest {
         assertFalse("included directory has not been deleted", new File(directory, "dir1").exists());
     }
 
-    private void createSymlink(File target, File link) throws IOException {
+    private boolean createSymlink(File target, File link) throws InterruptedException, CommandLineException {
+
         if (link.exists()) {
             link.delete();
         }
-        Files.createSymbolicLink(link.toPath(), target.toPath());
+
+        Commandline cli = new Commandline();
+        cli.setExecutable("ln");
+        cli.createArg().setValue("-s");
+        cli.createArg().setValue(target.getPath());
+        cli.createArg().setValue(link.getPath());
+
+        int result = cli.execute().waitFor();
+
         linkFiles.add(link);
+
+        return result == 0;
     }
 
     private File setupTestDirectory(String directoryName) throws IOException {