[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-10-08 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17773044#comment-17773044
 ] 

Elliotte Rusty Harold commented on MNG-7700:


I think this is now fixed so far as comparison goes. However, there's still an 
open question of whether the canonical version is correct (or matters. Maybe it 
doesn't.)

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.x-candidate, 4.0.x-candidate, 
> waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-10-08 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17773040#comment-17773040
 ] 

Michael Osipov commented on MNG-7700:
-

[~elharo], do you intend to work in this anytime soon? If not, remove your 
assignment...

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.x-candidate, 4.0.x-candidate, 
> waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-04-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17712735#comment-17712735
 ] 

ASF GitHub Bot commented on MNG-7700:
-

elharo commented on PR #1014:
URL: https://github.com/apache/maven/pull/1014#issuecomment-1509991217

   See above. That Issue should not be closed because of this PR. JIRA issues 
and PRs have a many-to-many relationship. A PR can address more than one JIRA 
issue and a JIRA issue often requires more than one PR to fix. 




> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.x-candidate, 4.0.0-alpha-5, 
> waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-04-15 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17712730#comment-17712730
 ] 

ASF GitHub Bot commented on MNG-7700:
-

slachiewicz commented on PR #1014:
URL: https://github.com/apache/maven/pull/1014#issuecomment-1509990216

   please remember to close associated jira




> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.x-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-03-01 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17695390#comment-17695390
 ] 

ASF GitHub Bot commented on MNG-7700:
-

elharo merged PR #1014:
URL: https://github.com/apache/maven/pull/1014




> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-27 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693900#comment-17693900
 ] 

Michael Osipov commented on MNG-7700:
-

Guys, it'd be nice if you could settle on this in a week or so, I'd intend to 
push 3.8.8 by 2023-03-08.

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-26 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693640#comment-17693640
 ] 

ASF GitHub Bot commented on MNG-7700:
-

elharo commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1118082057


##
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##
@@ -209,6 +208,26 @@ public void testVersionComparing() {
 checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
 }
 
+@Test
+public void testLeadingZeroes() {
+checkVersionsOrder("0.7", "2");
+checkVersionsOrder("0.2", "1.0.7");
+}
+
+@Test
+public void testGetCanonical() {
+// MNG-7700
+newComparable("0.x");
+newComparable("0-x");
+newComparable("0.rc");
+newComparable("0-1");
+
+ComparableVersion version = new ComparableVersion("0.x");
+assertEquals("x", version.getCanonical());

Review Comment:
   I'm testing that the input produces the output. That is useful. There's a 
case to be made that the current behavior is wrong, which can be discussed on 
the bug. If we decide it is and change it, then having this test here will make 
it clear what changed when.
   
   The test you suggest is also good. However, it's (not so obviously) 
performed in line 220 by `newComparable("0.x")` which includes an assert to 
check that.





> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-25 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693491#comment-17693491
 ] 

ASF GitHub Bot commented on MNG-7700:
-

dmlloyd commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1117940782


##
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##
@@ -209,6 +208,26 @@ public void testVersionComparing() {
 checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
 }
 
+@Test
+public void testLeadingZeroes() {
+checkVersionsOrder("0.7", "2");
+checkVersionsOrder("0.2", "1.0.7");
+}
+
+@Test
+public void testGetCanonical() {
+// MNG-7700
+newComparable("0.x");
+newComparable("0-x");
+newComparable("0.rc");
+newComparable("0-1");
+
+ComparableVersion version = new ComparableVersion("0.x");
+assertEquals("x", version.getCanonical());

Review Comment:
   This is not really a useful test. You're just testing that the output is 
what the output is. If you do this instead, you'll see that the "canonical" 
version is not really a canonical version at all:
   
   ```java
   ComparableVersion version = new ComparableVersion("0.x");
   ComparableVersion canonical = new ComparableVersion(version.getCanonical());
   assertEquals(canonical, version); // actually see if the *versions* are equal
   ```
   





> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-25 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693480#comment-17693480
 ] 

ASF GitHub Bot commented on MNG-7700:
-

michael-o commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1117932771


##
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##
@@ -209,6 +208,26 @@ public void testVersionComparing() {
 checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
 }
 
+@Test
+public void testLeadingZeroes() {
+checkVersionsOrder("0.7", "2");
+checkVersionsOrder("0.2", "1.0.7");
+}
+
+@Test
+public void testGetCanonical() {
+// MNG-7700
+newComparable("0.x");
+newComparable("0-x");
+newComparable("0.rc");
+newComparable("0-1");
+
+ComparableVersion version = new ComparableVersion("0.x");
+assertEquals("x", version.getCanonical());

Review Comment:
   Depressing...





> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-25 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693478#comment-17693478
 ] 

ASF GitHub Bot commented on MNG-7700:
-

elharo commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1117930896


##
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##
@@ -209,6 +208,26 @@ public void testVersionComparing() {
 checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
 }
 
+@Test
+public void testLeadingZeroes() {
+checkVersionsOrder("0.7", "2");
+checkVersionsOrder("0.2", "1.0.7");
+}
+
+@Test
+public void testGetCanonical() {
+// MNG-7700
+newComparable("0.x");
+newComparable("0-x");
+newComparable("0.rc");
+newComparable("0-1");
+
+ComparableVersion version = new ComparableVersion("0.x");
+assertEquals("x", version.getCanonical());

Review Comment:
   We never define or promise anything about the canonical representation of a 
ComparableVersion. Indeed, this method probably shouldn't have been public. All 
we promise is that two of them compare according to spec, and as best I can 
tell they do. For now this is just a characterization test of existing 
behavior. I'm leaving MNG-7700 open in case folks feel we should change the 
canonical representation. However neither that issue nor this PR needs to block 
the release.  





> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-25 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693473#comment-17693473
 ] 

ASF GitHub Bot commented on MNG-7700:
-

michael-o commented on code in PR #1014:
URL: https://github.com/apache/maven/pull/1014#discussion_r1117927578


##
maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java:
##
@@ -209,6 +208,26 @@ public void testVersionComparing() {
 checkVersionsOrder("2.0.1-xyz", "2.0.1-123");
 }
 
+@Test
+public void testLeadingZeroes() {
+checkVersionsOrder("0.7", "2");
+checkVersionsOrder("0.2", "1.0.7");
+}
+
+@Test
+public void testGetCanonical() {
+// MNG-7700
+newComparable("0.x");
+newComparable("0-x");
+newComparable("0.rc");
+newComparable("0-1");
+
+ComparableVersion version = new ComparableVersion("0.x");
+assertEquals("x", version.getCanonical());

Review Comment:
   I still don't understand why this should not be 0 with `x` as qualifier.





> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Minor
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-24 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693443#comment-17693443
 ] 

Elliotte Rusty Harold commented on MNG-7700:


same results on the 3.9.x branch. We might want to clean up the minor 
inconsistency between 0.x and 0.2 but this doesn't feel like a blocker to me. 

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Major
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-24 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693438#comment-17693438
 ] 

ASF GitHub Bot commented on MNG-7700:
-

elharo opened a new pull request, #1014:
URL: https://github.com/apache/maven/pull/1014

   Also clean up docs, generics, and comparisons




> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Major
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-24 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693436#comment-17693436
 ] 

Elliotte Rusty Harold commented on MNG-7700:


To be specific, these unit tests both pass:

```
@Test
public void testLeadingZeroes() {
checkVersionsOrder("0.7", "2");
checkVersionsOrder( "0.2", "1.0.7");
}

@Test
public void testGetCanonical() {
// MNG-7700
newComparable("0.x");
newComparable("0-x");
newComparable("0.rc");
newComparable("0-1");

ComparableVersion version = new ComparableVersion("0.x");
assertEquals("x", version.getCanonical());
ComparableVersion version2 = new ComparableVersion("0.2");
assertEquals("0.2", version2.getCanonical());
}
```

If you have one that fails, let me know. 

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Major
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-24 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693435#comment-17693435
 ] 

Elliotte Rusty Harold commented on MNG-7700:


At head I am unable to reproduce any cases where the comparison is 
inconsistent. All four cases of No in the above table seem to be yes in my 
testing, at least at head.

There is a slight inconsistency in canonicalization, which we don't really 
define. That is, 

"0.x" canonicalizes to "x"

whereas

"0.2" canonicalizes to "0.2"

However this doesn't appear to affect comparisons so far as I can determine. 




> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Major
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-24 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693385#comment-17693385
 ] 

Elliotte Rusty Harold commented on MNG-7700:


The tricky cases all seem to involve leading zeroes. E.g. 0.7 resolves to 7, 
not to 0.7. This feels wrong to me, but it is the behavior of the code and I 
can see an argument for it in 
https://maven.apache.org/pom.html#version-order-specification.
I think we need to revise both code and spec so that 0.7 and 0-7 do not 
canonicalize to "7", perhaps by more carefully defining what we mean by a 
*trailing* null value.

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Assignee: Elliotte Rusty Harold
>Priority: Major
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-20 Thread Elliotte Rusty Harold (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17691213#comment-17691213
 ] 

Elliotte Rusty Harold commented on MNG-7700:


https://maven.apache.org/pom.html#version-order-specification are the canonical 
rules Maven should follow. This explicitly states that

".qualifier" = "-qualifier" < "-number" < ".number"

Thus `1.x` is indeed equal to `1-x` when comparing versions. 

The 0.x and 0.rc cases are probably indeed wrong in the current code. The spec 
says "Then, starting from the end of the version, the trailing "null" values 
(0, "", "final", "ga") are trimmed. This process is repeated at each remaining 
hyphen from end to start."

0-x looks tricky. I suppose it depends on the definition of "trailing"



> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Priority: Major
> Fix For: 3.8.x-candidate, 3.9.1-candidate, waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> |{{0.rc}}|{{0.rc}}|yes|{{rc}}|no|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-17 Thread David M. Lloyd (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690628#comment-17690628
 ] 

David M. Lloyd commented on MNG-7700:
-

I don't think MNG-7644 covers this one; this is about canonical form. If `0-1` 
is canonically `1`, then `0-1` should equal `1`, but it does not.

The test is like this:

{code:java}
ComparableVersion parsed = new ComparableVersion(str);
ComparableVersion canon = new ComparableVersion(parsed.getCanonical());
boolean ok = parsed.equals(canon) && parsed.compareTo(canon) == 0 && 
canon.compareTo(parsed) == 0;
{code}

For the versions listed with "No" under "OK?", this test does not pass.

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Priority: Major
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-17 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690618#comment-17690618
 ] 

Michael Osipov commented on MNG-7700:
-

Please check MNG-7644.

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Priority: Major
> Fix For: waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-17 Thread David M. Lloyd (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690617#comment-17690617
 ] 

David M. Lloyd commented on MNG-7700:
-

This is easy to test by hand using [JBang|https://www.jbang.dev/]:


{code}
$ jbang org.apache.maven:maven-artifact:3.8.6 1.x
Display parameters as parsed by Maven (in canonical form and as a list of 
tokens) and comparison result:
1. 1.x -> 1.x; tokens: [1, x]
{code}

{code}
$ jbang org.apache.maven:maven-artifact:3.8.7 1.x
Display parameters as parsed by Maven (in canonical form and as a list of 
tokens) and comparison result:
1. 1.x -> 1-x; tokens: [1, [x]]
{code}


> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.7, 3.9.0
>Reporter: David M. Lloyd
>Priority: Major
> Fix For: waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-17 Thread David M. Lloyd (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690611#comment-17690611
 ] 

David M. Lloyd commented on MNG-7700:
-

The behavior changed between 3.8.6 and 3.8.7 (which behaves the same as 3.9.0).

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.6, 3.9.0
>Reporter: David M. Lloyd
>Priority: Major
> Fix For: waiting-for-feedback
>
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (MNG-7700) Improper canonicalization of versions

2023-02-17 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/MNG-7700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690607#comment-17690607
 ] 

Michael Osipov commented on MNG-7700:
-

Please verify 3.8.7 and not 3.8.6.

> Improper canonicalization of versions
> -
>
> Key: MNG-7700
> URL: https://issues.apache.org/jira/browse/MNG-7700
> Project: Maven
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 3.8.6, 3.9.0
>Reporter: David M. Lloyd
>Priority: Major
>
> The canonicalization logic for versions is incorrect.
> Using the method {{ComparableVersion#getCanonical}} as in {{new 
> ComparableVersion(input).getCanonical()}}, the following results can be 
> observed:
> ||Input||3.8.6 Output||3.8.6 OK?||3.9.0 Output||3.9.0 OK?||
> |{{1}}|{{1}}|yes|{{1}}|yes|
> |{{0.1}}|{{0.1}}|yes|{{0.1}}|yes|
> |{{0-1}}|{{1}}|no|{{1}}|no|
> |{{1.x}}|{{1.x}}|yes|{{1-x}}|maybe*|
> |{{1-x}}|{{1-x}}|yes|{{1-x}}|yes|
> |{{0.x}}|{{0.x}}|yes|{{x}}|no|
> |{{0-x}}|{{x}}|no|{{x}}|no|
> |{{x}}|{{x}}|yes|{{x}}|yes|
> The "OK?" columns indicate whether parsing the canonical version string will 
> yield a {{ComparableVersion}} instance that is {{equal}} to one constructed 
> from the original input, i.e. it's internally consistent.
> The "maybe*" item indicates that starting with 3.9.0, version `1.x` is now 
> considered to be equal to `1-x`. I'm not sure if this is a bug or not, or was 
> intentional or not, but it is definitely a change.
> These canonicalizations seem to have gotten less consistent in the move to 
> 3.9.0.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)