Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SelectorUtils.matchPath(): inconsistent behaviour on POSIX-like and Windows for single Wildcard pattern #191

Copy link
Copy link
Closed
@fishermans

Description

@fishermans
Issue body actions

Hi,

I was wondering why maven-shade-plugin produces different results on Windows and MAC. The single wildcard match is working inconsistently depending on the OS.

Please find a test to reproduce this (see comments in test file):

import org.codehaus.plexus.util.SelectorUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class PatternMatcherTest {

  @Test
  void testPatternMatchSingleWildCardLinux() {

    /* Passes on Linux - fails on Windows */
    Assertions.assertFalse(SelectorUtils.matchPath(
            "/com/test/*",
            "/com/test/test/hallo"));
  }


  @Test
  void testPatternMatchDoubleWildCardCaseInLinux() {

    /* OK */
    Assertions.assertTrue(SelectorUtils.matchPath(
            "/com/test/**",
            "/com/test/test/hallo"));
  }


  @Test
  void testPatternMatchDoubleWildCardLinux() {

    /* OK */
    Assertions.assertTrue(SelectorUtils.matchPath(
            "/com/test/**",
            "/com/test/test/hallo"));
  }


  @Test
  void testPatternMatchSingleWildCardWindows() {

    /* Fails on Linux - passes on Windows */
    Assertions.assertFalse(SelectorUtils.matchPath(
            "D:\\com\\test\\*",
            "D:\\com\\test\\test\\hallo"));
  }


  @Test
  void testPatternMatchDoubleWildCardWindows() {

    /* OK */
    Assertions.assertTrue(SelectorUtils.matchPath(
            "D:\\com\\test\\**",
            "D:\\com\\test\\test\\hallo"));
  }


  @Test
  void testPatternMatchSingleWildCardDotLinux() {

    /* Fails on Linux - fails on Windows */
    Assertions.assertFalse(SelectorUtils.matchPath(
            "com.test.*",
            "com.test.test.hallo"));
  }


  @Test
  void testPatternMatchDoubleWildCardDotLinux() {

    /* OK */
    Assertions.assertTrue(SelectorUtils.matchPath(
            "com.test.**",
            "com.test.test.hallo"));
  }
}

BG

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.