Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-12 Thread Igor Gnatenko
On Mon, Sep 12, 2016 at 4:36 PM, Panu Matilainen
 wrote:
> On 09/12/2016 05:31 PM, Igor Gnatenko wrote:
>>
>> On Mon, Sep 12, 2016 at 4:27 PM, Panu Matilainen
>>  wrote:
>>>
>>> On 09/12/2016 05:18 PM, Panu Matilainen wrote:


 On 09/12/2016 03:10 PM, Neal Gompa wrote:
>
>
> On Mon, Sep 12, 2016 at 8:07 AM, Florian Festi 
> wrote:
>>
>>
>> Changing the way + is treated in version compare is really a bad idea.
>> So this feature would need a new char that is currently not permitted
>> in
>> versions. Candidates include: #, ^, @, §, $, ?
>>>
>>>
>>>
>>> Other possible candidates would be |, %, &, ! and *.
>>
>> | is shell-ish
>> % is already taken by RPM
>> & is shell-ish
>> ! is shell-ish
>> * is shell-sih
>
>
> Yes, but then both tilde and caret have a special meaning in shell as well.
There is some escaping done for that (/me checked with rpm -ivh).
>
> ?, *, & and | certainly seem like begging for trouble, others to lesser
> degree.
with ! there is no escaping (I'm not sure it's even possible).
>
>
> - Panu -
>
> ___
> Rpm-ecosystem mailing list
> Rpm-ecosystem@lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-ecosystem



-- 
-Igor Gnatenko
___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem


Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-12 Thread Panu Matilainen

On 09/12/2016 05:18 PM, Panu Matilainen wrote:

On 09/12/2016 03:10 PM, Neal Gompa wrote:

On Mon, Sep 12, 2016 at 8:07 AM, Florian Festi  wrote:

Changing the way + is treated in version compare is really a bad idea.
So this feature would need a new char that is currently not permitted in
versions. Candidates include: #, ^, @, §, $, ?


Other possible candidates would be |, %, &, ! and *.

Most of them clash with various shell features, making them cumbersome 
in reality, but certainly some more than others.


- Panu -

___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem


Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-12 Thread Panu Matilainen

On 09/12/2016 03:10 PM, Neal Gompa wrote:

On Mon, Sep 12, 2016 at 8:07 AM, Florian Festi  wrote:

Changing the way + is treated in version compare is really a bad idea.
So this feature would need a new char that is currently not permitted in
versions. Candidates include: #, ^, @, §, $, ?


Why is changing '+' in version comparison a bad idea? It currently
exists as a separator that does nothing, and every usage of it I've
seen even in RPM-based distros makes the assumption that it works the
way the proposed changes will actually make it function.

If anything, this would align how the operator is used in practice,
which is always a good thing, in my book.


I'm on Florians side here.

Changing longstanding existing semantics is always risky business, you 
dont know what might break in somebodys environment. Neither do I. 
There's no point taking a risk of breakage when its not needed.


- Panu -
___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem


Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-12 Thread Neal Gompa
On Mon, Sep 12, 2016 at 8:07 AM, Florian Festi  wrote:
> Changing the way + is treated in version compare is really a bad idea.
> So this feature would need a new char that is currently not permitted in
> versions. Candidates include: #, ^, @, §, $, ?

Why is changing '+' in version comparison a bad idea? It currently
exists as a separator that does nothing, and every usage of it I've
seen even in RPM-based distros makes the assumption that it works the
way the proposed changes will actually make it function.

If anything, this would align how the operator is used in practice,
which is always a good thing, in my book.


-- 
真実はいつも一つ!/ Always, there's only one truth!
___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem


Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-10 Thread Neal Gompa
On Sat, Sep 10, 2016 at 2:02 AM, Igor Gnatenko  wrote:
> Attaching patch to what I came up.
>
> If everything looks good, I will write same for libsolv.
>

Looks good to me, though where's the logic for the rpmlib() tag for
the behavior change?


-- 
真実はいつも一つ!/ Always, there's only one truth!
___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem


Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-10 Thread Igor Gnatenko
Attaching patch to what I came up.

If everything looks good, I will write same for libsolv.

On Sat, Sep 10, 2016 at 12:58 AM, Zbigniew Jędrzejewski-Szmek
 wrote:
> On Fri, Sep 09, 2016 at 05:23:26PM -0400, Neal Gompa wrote:
>> On Fri, Sep 9, 2016 at 4:24 PM, Igor Gnatenko  wrote:
>> > Hi,
>> >
>> > during process of getting tilde approved in Fedora Packaging
>> > Guidelines we realized that we need some special handling for
>> > separator (most probably) "+".
>> >
>> > Some examples (left is what expected, right is what current situation):
>> > 1.0+ > 1.0  | 1.0+ == 1.0
>> > 1.0+20160101git < 1.0.1 | 1.0+20160101git > 1.0.1
>> >
>> > During long discussion at #rpm.org on freenode with Florian and Panu:
>> >
>> > 1. Florian didn't like to change behavior of "+" as it's already
>> > allowed character and people might expect it to do something
>> > different.
>> > 2. From alternative symbols we needed to choose from: "@", "#", "^"
>> >
>> > After thinking more about problem I realized that we probably just
>> > change behavior of "+".
>>
>> Yes, this is the right way to go, as we don't need more "specialness"
>> and it's relatively intuitive to indicate + as the
>> checkout above it.
>
> +1
>
>> > Some questions are still in my mind:
>> > * vercmp: 1~ ? 1+
>>
>> I'm not sure here. Normally, you use "1~" to indicate an all-inclusive
>> set (pre-release, release, and post-release), as opposed to "1" (which
>> would include only release and post-release).
>>
>> Strictly speaking 1~ < 1+ in comparison, as the tilde operator pushes
>> it down and the plus operator would push it up.
>
> Yes, I don't think it can be any doubt here. ~ is defined so that
> 1~ < 1, and 1 < 1+, so 1~ < 1+ by transitiveness of unequality operations.
>
>> > * How "+" should be handled in (Build)Requires?
>> > * BuildRequires: foo == 1+ should match 1+, 1+git, 1+whatever ?
>>
>> I'm not sure exactly how this should be handled... Probably 1+?
>
> Why should we introduce any special behaviour here? Normally the ==
> operator requires an exact version match, and version 1+ !=
> 1+whatever, just like 1 != 1whatever, so 1+ should only match 1+. If
> you want to match things starting with 1+, just write BuildRequires
> foo >= 1+ .
>
>> > * BuildRequires: foo >= 1 should match 1, 1.1, 1+git, 1.1+whatever ?
>>
>> Yes.
>>
>> > * BuildRequires: foo < 1+ should match 1, 1~git, 0.whatever ?
>>
>> Yes.
>
> Yes, yes.
>
> Zbyszek
> ___
> Rpm-ecosystem mailing list
> Rpm-ecosystem@lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-ecosystem



-- 
-Igor Gnatenko
diff --git a/lib/rpmvercmp.c b/lib/rpmvercmp.c
index b3d08fa..0d59d96 100644
--- a/lib/rpmvercmp.c
+++ b/lib/rpmvercmp.c
@@ -33,8 +33,8 @@ int rpmvercmp(const char * a, const char * b)
 
 /* loop through each version segment of str1 and str2 and compare them */
 while (*one || *two) {
-	while (*one && !risalnum(*one) && *one != '~') one++;
-	while (*two && !risalnum(*two) && *two != '~') two++;
+	while (*one && !risalnum(*one) && *one != '~' && *one != '+') one++;
+	while (*two && !risalnum(*two) && *two != '~' && *two != '+') two++;
 
 	/* handle the tilde separator, it sorts before everything else */
 	if (*one == '~' || *two == '~') {
@@ -45,6 +45,16 @@ int rpmvercmp(const char * a, const char * b)
 	continue;
 	}
 
+	if (*one == '+' || *two == '+') {
+	if (*one == '\0') return -1;
+	if (*two == '\0') return 1;
+	if (*one != '+') return 1;
+	if (*two != '+') return -1;
+	one++;
+	two++;
+	continue;
+	}
+
 	/* If we ran to the end of either, we are finished with the loop */
 	if (!(*one && *two)) break;
 
diff --git a/tests/rpmvercmp.at b/tests/rpmvercmp.at
index 2a25bdd..784a60c 100644
--- a/tests/rpmvercmp.at
+++ b/tests/rpmvercmp.at
@@ -78,17 +78,17 @@ RPMVERCMP(2_0, 2.0, 0)
 
 dnl RhBug:178798 case
 RPMVERCMP(a, a, 0)
-RPMVERCMP(a+, a+, 0)
-RPMVERCMP(a+, a_, 0)
-RPMVERCMP(a_, a+, 0)
-RPMVERCMP(+a, +a, 0)
-RPMVERCMP(+a, _a, 0)
-RPMVERCMP(_a, +a, 0)
-RPMVERCMP(+_, +_, 0)
-RPMVERCMP(_+, +_, 0)
-RPMVERCMP(_+, _+, 0)
-RPMVERCMP(+, _, 0)
-RPMVERCMP(_, +, 0)
+RPMVERCMP(a., a., 0)
+RPMVERCMP(a., a_, 0)
+RPMVERCMP(a_, a., 0)
+RPMVERCMP(.a, .a, 0)
+RPMVERCMP(.a, _a, 0)
+RPMVERCMP(_a, .a, 0)
+RPMVERCMP(._, ._, 0)
+RPMVERCMP(_., ._, 0)
+RPMVERCMP(_., _., 0)
+RPMVERCMP(., _, 0)
+RPMVERCMP(_, ., 0)
 
 dnl Basic testcases for tilde sorting
 RPMVERCMP(1.0~rc1, 1.0~rc1, 0)
@@ -100,6 +100,32 @@ RPMVERCMP(1.0~rc1~git123, 1.0~rc1~git123, 0)
 RPMVERCMP(1.0~rc1~git123, 1.0~rc1, -1)
 RPMVERCMP(1.0~rc1, 1.0~rc1~git123, 1)
 
+dnl Basic testcases for plus sorting
+RPMVERCMP(1.0+, 1.0+, 0)
+RPMVERCMP(1.0+, 1.0, 1)
+RPMVERCMP(1.0, 1.0+, -1)
+RPMVERCMP(1.0+git1, 1.0+git1, 0)
+RPMVERCMP(1.0+git1, 1.0, 1)
+RPMVERCMP(1.0, 1.0+git1, -1)
+RPMVERCMP(1.0+git1, 1.0+git2, -1)
+RPMVERCMP(1.0+git2, 1.0+git1, 1)
+RPMVERCMP(1.0+git1, 1.01, -1)
+RPMVERCMP(1.01, 1.0+git1, 1)

Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-09 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Sep 09, 2016 at 05:23:26PM -0400, Neal Gompa wrote:
> On Fri, Sep 9, 2016 at 4:24 PM, Igor Gnatenko  wrote:
> > Hi,
> >
> > during process of getting tilde approved in Fedora Packaging
> > Guidelines we realized that we need some special handling for
> > separator (most probably) "+".
> >
> > Some examples (left is what expected, right is what current situation):
> > 1.0+ > 1.0  | 1.0+ == 1.0
> > 1.0+20160101git < 1.0.1 | 1.0+20160101git > 1.0.1
> >
> > During long discussion at #rpm.org on freenode with Florian and Panu:
> >
> > 1. Florian didn't like to change behavior of "+" as it's already
> > allowed character and people might expect it to do something
> > different.
> > 2. From alternative symbols we needed to choose from: "@", "#", "^"
> >
> > After thinking more about problem I realized that we probably just
> > change behavior of "+".
> 
> Yes, this is the right way to go, as we don't need more "specialness"
> and it's relatively intuitive to indicate + as the
> checkout above it.

+1

> > Some questions are still in my mind:
> > * vercmp: 1~ ? 1+
> 
> I'm not sure here. Normally, you use "1~" to indicate an all-inclusive
> set (pre-release, release, and post-release), as opposed to "1" (which
> would include only release and post-release).
>
> Strictly speaking 1~ < 1+ in comparison, as the tilde operator pushes
> it down and the plus operator would push it up.

Yes, I don't think it can be any doubt here. ~ is defined so that
1~ < 1, and 1 < 1+, so 1~ < 1+ by transitiveness of unequality operations.

> > * How "+" should be handled in (Build)Requires?
> > * BuildRequires: foo == 1+ should match 1+, 1+git, 1+whatever ?
> 
> I'm not sure exactly how this should be handled... Probably 1+?

Why should we introduce any special behaviour here? Normally the ==
operator requires an exact version match, and version 1+ !=
1+whatever, just like 1 != 1whatever, so 1+ should only match 1+. If
you want to match things starting with 1+, just write BuildRequires
foo >= 1+ .

> > * BuildRequires: foo >= 1 should match 1, 1.1, 1+git, 1.1+whatever ?
> 
> Yes.
> 
> > * BuildRequires: foo < 1+ should match 1, 1~git, 0.whatever ?
> 
> Yes.

Yes, yes.

Zbyszek
___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem


Re: [Rpm-ecosystem] Special meaning of "+" (?) separator

2016-09-09 Thread Neal Gompa
On Fri, Sep 9, 2016 at 4:24 PM, Igor Gnatenko  wrote:
> Hi,
>
> during process of getting tilde approved in Fedora Packaging
> Guidelines we realized that we need some special handling for
> separator (most probably) "+".
>
> Some examples (left is what expected, right is what current situation):
> 1.0+ > 1.0  | 1.0+ == 1.0
> 1.0+20160101git < 1.0.1 | 1.0+20160101git > 1.0.1
>
> During long discussion at #rpm.org on freenode with Florian and Panu:
>
> 1. Florian didn't like to change behavior of "+" as it's already
> allowed character and people might expect it to do something
> different.
> 2. From alternative symbols we needed to choose from: "@", "#", "^"
>
> After thinking more about problem I realized that we probably just
> change behavior of "+".

Yes, this is the right way to go, as we don't need more "specialness"
and it's relatively intuitive to indicate + as the
checkout above it.

> Some questions are still in my mind:
> * vercmp: 1~ ? 1+

I'm not sure here. Normally, you use "1~" to indicate an all-inclusive
set (pre-release, release, and post-release), as opposed to "1" (which
would include only release and post-release).

Strictly speaking 1~ < 1+ in comparison, as the tilde operator pushes
it down and the plus operator would push it up.

> * How "+" should be handled in (Build)Requires?
> * BuildRequires: foo == 1+ should match 1+, 1+git, 1+whatever ?

I'm not sure exactly how this should be handled... Probably 1+?

> * BuildRequires: foo >= 1 should match 1, 1.1, 1+git, 1.1+whatever ?

Yes.

> * BuildRequires: foo < 1+ should match 1, 1~git, 0.whatever ?

Yes.

>
> Thoughts? Suggestions?
> --
> -Igor Gnatenko
> ___
> Rpm-ecosystem mailing list
> Rpm-ecosystem@lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-ecosystem



-- 
真実はいつも一つ!/ Always, there's only one truth!
___
Rpm-ecosystem mailing list
Rpm-ecosystem@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-ecosystem