Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-02-02 Thread - Neustradamus -
Dear Simon,

Any news for 2.84 CHANGELOG?
- http://www.thekelleys.org.uk/dnsmasq/CHANGELOG

Already informed here:
- http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q1/014656.html

I think that you will release a correct 2.85 version soon with the 2.84 
CHANGELOG at the same time?

Thanks in advance.

Regards,

Neustradamus


De : Dnsmasq-discuss  de la 
part de Dirk Fieldhouse 
Envoyé : mardi 2 février 2021 01:46
À : dnsmasq-discuss@lists.thekelleys.org.uk
Objet : Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic 
versioning

On 01/02/2021 23:55, Simon Kelley wrote:
>>
> I just committed another tweak, to get eg v2.65test1 and v2.65test11 in
> the correct order.

Maybe the missing description of 2.84 could be added to CHANGELOG and
the resulting commit, exceptionally, re-tagged as 2.84?

Wouldn't this also avoid accidentally acquiring the rc2 tag, so making
tweaks to get-version moot (or postponing the need for a new tagging
scheme, according to taste) for now? Resulting binaries should be
functionally identical, except for pre-tweak builds where the output of
'dnsmasq --version', etc, would differ.

Eg:

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+version 2.84
+ Fix a regression causing random log messages "failure to send
+ packet" and the loss of the associated DNS queries, after which a
+ retry would succeed, when dnsmasq was under fairly heavy load and
+ was configured for a mixture or IPv4 and IPv6 upstream DNS servers
+ or, possibly, was using --bind-interfaces.
+
+ Housekeeping (2021).
+
+
  version 2.83
   Use the values of --min-port and --max-port in outgoing
   TCP connections to upstream DNS servers.

---

sort -k isn't a GNU extension: it's in POSIX.1.

/df

--
London SW6
UK

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-02-01 Thread Dirk Fieldhouse

On 01/02/2021 23:55, Simon Kelley wrote:

>
I just committed another tweak, to get eg v2.65test1 and v2.65test11 in
the correct order.


Maybe the missing description of 2.84 could be added to CHANGELOG and
the resulting commit, exceptionally, re-tagged as 2.84?

Wouldn't this also avoid accidentally acquiring the rc2 tag, so making
tweaks to get-version moot (or postponing the need for a new tagging
scheme, according to taste) for now? Resulting binaries should be
functionally identical, except for pre-tweak builds where the output of
'dnsmasq --version', etc, would differ.

Eg:

--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,13 @@
+version 2.84
+ Fix a regression causing random log messages "failure to send
+ packet" and the loss of the associated DNS queries, after which a
+ retry would succeed, when dnsmasq was under fairly heavy load and
+ was configured for a mixture or IPv4 and IPv6 upstream DNS servers
+ or, possibly, was using --bind-interfaces.
+
+ Housekeeping (2021).
+
+
 version 2.83
  Use the values of --min-port and --max-port in outgoing
  TCP connections to upstream DNS servers.

---

sort -k isn't a GNU extension: it's in POSIX.1.

/df

--
London SW6
UK

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-02-01 Thread Simon Kelley
On 31/01/2021 11:21, Geert Stappers wrote:
>
> Besides not pretty,  it is also not readable.
> Plus '-k 1.6,1.6' looks very odd in that line. 
> 
> |  sort -k1.2,1.5r -k1.6,1.7r -k1.8,1.9r -k1.10,1.11r
> looks more "having a pattern"

But it's wrong. The -k1.6,1.6 sorts on the first letter _after_ the
version number, so it sorts v2.65 before v2.65rc1 before v.265test1,
because  sorts before 'r' which sorts before 't'
> 
> 
> Frankly I think we are repairing at the wrong place.
> Instead of handcrafting a sort algoritme, we should repair our
> versioning name convention.  Tilde to the  rescue   :-)

Fixing the sort happens in one place, adapting my brain to a new
convention is less certain, and leaves a break in the record of versions.



I just committed another tweak, to get eg v2.65test1 and v2.65test11 in
the correct order.



Cheers,

Simon.



___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-02-01 Thread Simon Kelley
On 31/01/2021 19:27, Matthias Andree wrote:
> Am 31.01.21 um 12:21 schrieb Geert Stappers:
>> Lonnie Abelbeck's hint on another release was indeed very humble
>> and very polite. And yes, he is right with expressing
>>   We do ourself and the rest of mankind a favour by avoiding
>>   version string "2.84rc2" for verion "2.84"
> 
> Oh dear. It's not the first time that these two letters + digit were
> left in the version, it has happened before, and it is a sign of
> trusting 2.84, is it not? 2.84rc2 was tested and released unchanged.
> 
> Given the announcement and tagging and situation, what good is another
> release just to correct the version number? Can't we just politely ask
> packages to erase the "rc2"?
> (My FreeBSD package does exactly that to avoid questions, and I'd
> cheated a bit by shipping 2.84rc2 without the housekeeping as 2.83_1
> already because it was just regression fixes.)
> 
> Of course you can found a science in its own around the version number,
> but I'd propose that Simon's public statement that 2.84 = 2.84rc2 and an
> announcement on the list should just do fine.
> 
> 

Matthias,

One doubt I had on this is that the -k option to sort smells of a GNU
extension. Is it OK on *BSD?

Simon.


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-01-31 Thread Geert Stappers
On Sun, Jan 31, 2021 at 12:21:11PM +0100, Geert Stappers wrote:
> De : Simon Kelley 
> Envoyé : samedi 30 janvier 2021 00:19
> > On 26/01/2021 16:55, M. Buecher wrote:
> > > On 2021-01-26 17:41, M. Buecher wrote:
> > >> On 2021-01-26 00:43, Lonnie Abelbeck wrote:
> > >>> On Jan 25, 2021, at 5:21 PM, Lonnie Abelbeck wrote:
> > 
> >  The version string generated is "2.84rc2"
> > 
> >  $ cat dnsmasq-2.84/VERSION
> >  (HEAD -> master, tag: v2.84rc2, tag: v2.84, origin/master, origin/HEAD)
> > >>>
> > >>> This patch solves the problem:
>...
> > >>>
> > >>
> > >> Actually sort is not good at sorting semantic versions [1].
> > >> In some cases '-r' will work (2.84, 2.83-post1, 2.83) and in others it
> > >> won't (2.84-rc1, 2.84, 2.83). Same applies for sort without '-r'.
> > >>
> > >> [1] https://semver.org/
> > >>
> > >> Just my two cents
> > >> Maddes
> > >
> > > Forgot to reference the details for sort's -V|--version-sort option at
> > > https://www.gnu.org/software/coreutils/manual/coreutils.html#Implementation-Details
> 
> Thanks for providing that good information.
> 
> 
> > > Other wrote scripts in other languages like php, Python, etc., e.g.
> > > https://gist.github.com/andkirby/54204328823febad9d34422427b1937b
> > >
> > >
> > 
> > Lonnie's patch exactly reverses f4f400776b3c1aa303d1a0fcd500f0ab5bc970f2
> > from 2015, which I guess was to address a problem with a different set
> > of version strings.
> > 
> > After a certain amount of trial and error, I've managed to coax sort
> > into doing the right thing for version strings which dnsmasq uses.
> > 
> > v2.84 sorts before v2.83, but v2.83 sorts before v2.83rc1 and 2.83rc1
> > sorts before v2.83test1
> > 
> > 
> > It's not pretty:
> > 
> >  sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r
>  
> 
> Besides not pretty,  it is also not readable.
> Plus '-k 1.6,1.6' looks very odd in that line. 
> 
> |  sort -k1.2,1.5r -k1.6,1.7r -k1.8,1.9r -k1.10,1.11r
> looks more "having a pattern"
> 
> 
> Frankly I think we are repairing at the wrong place.
> Instead of handcrafting a sort algoritme, we should repair our
> versioning name convention.  Tilde to the  rescue   :-)
> 
> $ cat << HERE > old_convention
> v2.83
> v2.84test1
> v2.84test2
> v2.84rc1
> v2.84rc2
> v2.84
> HERE
> $ cat << HERE > new_convention
> v2.83
> v2.84~~test1
> v2.84~~test2
> v2.84~rc1
> v2.84~rc2
> v2.84
> HERE
> $ sort --version-sort old_convention 
> v2.83
> v2.84
> v2.84rc1
> v2.84rc2
> v2.84test1
> v2.84test2
> $ sort --version-sort new_convention 
> v2.83
> v2.84~~test1
> v2.84~~test2
> v2.84~rc1
> v2.84~rc2
> v2.84
> $ 
> 
> --- a/bld/get-version
> +++ b/bld/get-version
> @@ -9,9 +9,14 @@
>  # If we can find one which matches $v[0-9].* then we assume it's
>  # a version-number tag, else we just use the whole string.
>  # If there is more than one v[0-9].* tag, sort them and use the
> -# first. The insane arguments to the sort command are to ensure
> -# that, eg v2.64 comes before v2.63, but v2.63 comes before v2.63rc1
> -# and v2.63rc1 comes before v2.63test1
> +# last. This needs tilde character in the version, e.g.
> +#
> +#   v2.83
> +#   v2.84~~test1
> +#   v2.84~~test2
> +#   v2.84~rc1
> +#   v2.84~rc2
> +#   v2.84
>  
>  
>  # Change directory to the toplevel source directory.
> @@ -31,7 +36,7 @@ else
>   vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
>  
>   if [ $? -eq 0 ]; then
> - echo "${vers}" | sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r 
> | head -n 1 | sed 's/^v//'
> + echo "${vers}" | sort --version-sort | tail -n 1 | sed 's/^v//'
>   else
>   cat $1/VERSION
>   fi
> 
> 
> 
> > I'm assuming that people don't want yet another release just to fix
> > this, but if I've assumed wrong, let me know.
> 
> Lonnie Abelbeck's hint on another release was indeed very humble
> and very polite. And yes, he is right with expressing
>   We do ourself and the rest of mankind a favour by avoiding
>   version string "2.84rc2" for verion "2.84"
> 

Meanwhile I learnt they are the same. Both git tags are
on the same git commit.

commit 20295012b8815d0989332516c6ac51018746e92e (tag: v2.84rc2, tag: v2.84)



Groeten
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-01-31 Thread Matthias Andree
Am 31.01.21 um 12:21 schrieb Geert Stappers:
> Lonnie Abelbeck's hint on another release was indeed very humble
> and very polite. And yes, he is right with expressing
>   We do ourself and the rest of mankind a favour by avoiding
>   version string "2.84rc2" for verion "2.84"

Oh dear. It's not the first time that these two letters + digit were
left in the version, it has happened before, and it is a sign of
trusting 2.84, is it not? 2.84rc2 was tested and released unchanged.

Given the announcement and tagging and situation, what good is another
release just to correct the version number? Can't we just politely ask
packages to erase the "rc2"?
(My FreeBSD package does exactly that to avoid questions, and I'd
cheated a bit by shipping 2.84rc2 without the housekeeping as 2.83_1
already because it was just regression fixes.)

Of course you can found a science in its own around the version number,
but I'd propose that Simon's public statement that 2.84 = 2.84rc2 and an
announcement on the list should just do fine.


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-01-31 Thread Geert Stappers
De : Simon Kelley 
Envoyé : samedi 30 janvier 2021 00:19
> On 26/01/2021 16:55, M. Buecher wrote:
> > On 2021-01-26 17:41, M. Buecher wrote:
> >> On 2021-01-26 00:43, Lonnie Abelbeck wrote:
> >>> On Jan 25, 2021, at 5:21 PM, Lonnie Abelbeck wrote:
> 
>  The version string generated is "2.84rc2"
> 
>  $ cat dnsmasq-2.84/VERSION
>  (HEAD -> master, tag: v2.84rc2, tag: v2.84, origin/master, origin/HEAD)
> >>>
> >>> This patch solves the problem:
   ...
> >>>
> >>
> >> Actually sort is not good at sorting semantic versions [1].
> >> In some cases '-r' will work (2.84, 2.83-post1, 2.83) and in others it
> >> won't (2.84-rc1, 2.84, 2.83). Same applies for sort without '-r'.
> >>
> >> [1] https://semver.org/
> >>
> >> Just my two cents
> >> Maddes
> >
> > Forgot to reference the details for sort's -V|--version-sort option at
> > https://www.gnu.org/software/coreutils/manual/coreutils.html#Implementation-Details

Thanks for providing that good information.


> > Other wrote scripts in other languages like php, Python, etc., e.g.
> > https://gist.github.com/andkirby/54204328823febad9d34422427b1937b
> >
> >
> 
> Lonnie's patch exactly reverses f4f400776b3c1aa303d1a0fcd500f0ab5bc970f2
> from 2015, which I guess was to address a problem with a different set
> of version strings.
> 
> After a certain amount of trial and error, I've managed to coax sort
> into doing the right thing for version strings which dnsmasq uses.
> 
> v2.84 sorts before v2.83, but v2.83 sorts before v2.83rc1 and 2.83rc1
> sorts before v2.83test1
> 
> 
> It's not pretty:
> 
>  sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r
 

Besides not pretty,  it is also not readable.
Plus '-k 1.6,1.6' looks very odd in that line. 

|  sort -k1.2,1.5r -k1.6,1.7r -k1.8,1.9r -k1.10,1.11r
looks more "having a pattern"


Frankly I think we are repairing at the wrong place.
Instead of handcrafting a sort algoritme, we should repair our
versioning name convention.  Tilde to the  rescue   :-)

$ cat << HERE > old_convention
v2.83
v2.84test1
v2.84test2
v2.84rc1
v2.84rc2
v2.84
HERE
$ cat << HERE > new_convention
v2.83
v2.84~~test1
v2.84~~test2
v2.84~rc1
v2.84~rc2
v2.84
HERE
$ sort --version-sort old_convention 
v2.83
v2.84
v2.84rc1
v2.84rc2
v2.84test1
v2.84test2
$ sort --version-sort new_convention 
v2.83
v2.84~~test1
v2.84~~test2
v2.84~rc1
v2.84~rc2
v2.84
$ 

--- a/bld/get-version
+++ b/bld/get-version
@@ -9,9 +9,14 @@
 # If we can find one which matches $v[0-9].* then we assume it's
 # a version-number tag, else we just use the whole string.
 # If there is more than one v[0-9].* tag, sort them and use the
-# first. The insane arguments to the sort command are to ensure
-# that, eg v2.64 comes before v2.63, but v2.63 comes before v2.63rc1
-# and v2.63rc1 comes before v2.63test1
+# last. This needs tilde character in the version, e.g.
+#
+#   v2.83
+#   v2.84~~test1
+#   v2.84~~test2
+#   v2.84~rc1
+#   v2.84~rc2
+#   v2.84
 
 
 # Change directory to the toplevel source directory.
@@ -31,7 +36,7 @@ else
  vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep ^v[0-9]`
 
  if [ $? -eq 0 ]; then
- echo "${vers}" | sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r | 
head -n 1 | sed 's/^v//'
+ echo "${vers}" | sort --version-sort | tail -n 1 | sed 's/^v//'
  else
  cat $1/VERSION
  fi



> I'm assuming that people don't want yet another release just to fix
> this, but if I've assumed wrong, let me know.

Lonnie Abelbeck's hint on another release was indeed very humble
and very polite. And yes, he is right with expressing
  We do ourself and the rest of mankind a favour by avoiding
  version string "2.84rc2" for verion "2.84"


Groeten
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-01-30 Thread - Neustradamus -
No 2.84 in the CHANGELOG: http://www.thekelleys.org.uk/dnsmasq/CHANGELOG

Can you update it?

And can you solve the website problem?
- http://www.thekelleys.org.uk/dnsmasq/doc.html -> 
http://www.thekelleys.org.uk/dnsmasq/index.html

Thanks in advance.


De : Dnsmasq-discuss  de la 
part de Simon Kelley 
Envoyé : samedi 30 janvier 2021 00:19
À : dnsmasq-discuss@lists.thekelleys.org.uk
Objet : Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic 
versioning

On 26/01/2021 16:55, M. Buecher wrote:
>
>
> On 2021-01-26 17:41, M. Buecher wrote:
>> On 2021-01-26 00:43, Lonnie Abelbeck wrote:
>>>> On Jan 25, 2021, at 5:21 PM, Lonnie Abelbeck
>>>>  wrote:
>>>>
>>>>
>>>>> Get it here:
>>>>>
>>>>> http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.84.tar.gz
>>>>
>>>> The version string generated is "2.84rc2"
>>>>
>>>> $ cat dnsmasq-2.84/VERSION
>>>> (HEAD -> master, tag: v2.84rc2, tag: v2.84, origin/master, origin/HEAD)
>>>
>>> This patch solves the problem:
>>>
>>> --- dnsmasq-2.84/bld/get-version.orig2021-01-25
>>> 17:35:04.882908877 -0600
>>> +++ dnsmasq-2.84/bld/get-version2021-01-25 17:35:58.658467974 -0600
>>> @@ -28,7 +28,7 @@
>>>   vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep
>>> ^v[0-9]`
>>>
>>>   if [ $? -eq 0 ]; then
>>> - echo "${vers}" | sort -r | head -n 1 | sed 's/^v//'
>>> + echo "${vers}" | sort | head -n 1 | sed 's/^v//'
>>>   else
>>>   cat $1/VERSION
>>>   fi
>>
>> Actually sort is not good at sorting semantic versions [1].
>> In some cases '-r' will work (2.84, 2.83-post1, 2.83) and in others it
>> won't (2.84-rc1, 2.84, 2.83). Same applies for sort without '-r'.
>>
>> [1] https://semver.org/
>>
>> Just my two cents
>> Maddes
>
> Forgot to reference the details for sort's -V|--version-sort option at
> https://www.gnu.org/software/coreutils/manual/coreutils.html#Implementation-Details
>
> Other wrote scripts in other languages like php, Python, etc., e.g.
> https://gist.github.com/andkirby/54204328823febad9d34422427b1937b
>
>

Lonnie's patch exactly reverses f4f400776b3c1aa303d1a0fcd500f0ab5bc970f2
from 2015, which I guess was to address a problem with a different set
of version strings.

After a certain amount of trial and error, I've managed to coax sort
into doing the right thing for version strings which dnsmasq uses.

v2.84 sorts before v2.83, but v2.83 sorts before v2.83rc1 and 2.83rc1
sorts before v2.83test1


It's not pretty:

sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r

I'm assuming that people don't want yet another release just to fix
this, but if I've assumed wrong, let me know.


Cheers,

Simon.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-01-29 Thread Simon Kelley
On 26/01/2021 16:55, M. Buecher wrote:
> 
> 
> On 2021-01-26 17:41, M. Buecher wrote:
>> On 2021-01-26 00:43, Lonnie Abelbeck wrote:
 On Jan 25, 2021, at 5:21 PM, Lonnie Abelbeck
  wrote:


> Get it here:
>
> http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.84.tar.gz

 The version string generated is "2.84rc2"

 $ cat dnsmasq-2.84/VERSION
 (HEAD -> master, tag: v2.84rc2, tag: v2.84, origin/master, origin/HEAD)
>>>
>>> This patch solves the problem:
>>>
>>> --- dnsmasq-2.84/bld/get-version.orig    2021-01-25
>>> 17:35:04.882908877 -0600
>>> +++ dnsmasq-2.84/bld/get-version    2021-01-25 17:35:58.658467974 -0600
>>> @@ -28,7 +28,7 @@
>>>   vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep
>>> ^v[0-9]`
>>>
>>>   if [ $? -eq 0 ]; then
>>> - echo "${vers}" | sort -r | head -n 1 | sed 's/^v//'
>>> + echo "${vers}" | sort | head -n 1 | sed 's/^v//'
>>>   else
>>>   cat $1/VERSION
>>>   fi
>>
>> Actually sort is not good at sorting semantic versions [1].
>> In some cases '-r' will work (2.84, 2.83-post1, 2.83) and in others it
>> won't (2.84-rc1, 2.84, 2.83). Same applies for sort without '-r'.
>>
>> [1] https://semver.org/
>>
>> Just my two cents
>> Maddes
> 
> Forgot to reference the details for sort's -V|--version-sort option at
> https://www.gnu.org/software/coreutils/manual/coreutils.html#Implementation-Details
> 
> Other wrote scripts in other languages like php, Python, etc., e.g.
> https://gist.github.com/andkirby/54204328823febad9d34422427b1937b
> 
> 

Lonnie's patch exactly reverses f4f400776b3c1aa303d1a0fcd500f0ab5bc970f2
from 2015, which I guess was to address a problem with a different set
of version strings.

After a certain amount of trial and error, I've managed to coax sort
into doing the right thing for version strings which dnsmasq uses.

v2.84 sorts before v2.83, but v2.83 sorts before v2.83rc1 and 2.83rc1
sorts before v2.83test1


It's not pretty:

sort -k1.2,1.5r -k 1.6,1.6 -k1.8,1.9r -k1.10,1.11r

I'm assuming that people don't want yet another release just to fix
this, but if I've assumed wrong, let me know.


Cheers,

Simon.

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Announce: dnsmasq-2.84 - sort and semantic versioning

2021-01-26 Thread M. Buecher




On 2021-01-26 17:41, M. Buecher wrote:

On 2021-01-26 00:43, Lonnie Abelbeck wrote:
On Jan 25, 2021, at 5:21 PM, Lonnie Abelbeck 
 wrote:




Get it here:

http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.84.tar.gz


The version string generated is "2.84rc2"

$ cat dnsmasq-2.84/VERSION
(HEAD -> master, tag: v2.84rc2, tag: v2.84, origin/master, 
origin/HEAD)


This patch solves the problem:

--- dnsmasq-2.84/bld/get-version.orig	2021-01-25 17:35:04.882908877 
-0600

+++ dnsmasq-2.84/bld/get-version2021-01-25 17:35:58.658467974 -0600
@@ -28,7 +28,7 @@
  vers=`cat $1/VERSION | sed 's/[(), ]/,/ g' | tr ',' '\n' | grep 
^v[0-9]`


  if [ $? -eq 0 ]; then
- echo "${vers}" | sort -r | head -n 1 | sed 's/^v//'
+ echo "${vers}" | sort | head -n 1 | sed 's/^v//'
  else
  cat $1/VERSION
  fi


Actually sort is not good at sorting semantic versions [1].
In some cases '-r' will work (2.84, 2.83-post1, 2.83) and in others it
won't (2.84-rc1, 2.84, 2.83). Same applies for sort without '-r'.

[1] https://semver.org/

Just my two cents
Maddes


Forgot to reference the details for sort's -V|--version-sort option at 
https://www.gnu.org/software/coreutils/manual/coreutils.html#Implementation-Details
Other wrote scripts in other languages like php, Python, etc., e.g. 
https://gist.github.com/andkirby/54204328823febad9d34422427b1937b



___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss