Re: 9.99.100 fallout: file(1)

2022-09-22 Thread Christos Zoulas
In article ,
Michael van Elst  wrote:
>campbell+netbsd-tech-k...@mumble.net (Taylor R Campbell) writes:
>
>>We appear to have revived the old alphanumeric versioning scheme,
>>according to file(1)!  Someone needs to teach file(1) that this is
>>9.99.100, not 9.99A(.0).
>
>Index: external/bsd/file/dist/src/readelf.c
>===
>RCS file: /cvsroot/src/external/bsd/file/dist/src/readelf.c,v
>retrieving revision 1.25
>diff -p -u -r1.25 readelf.c
>--- external/bsd/file/dist/src/readelf.c   9 Apr 2021 19:11:42 -   
>1.25
>+++ external/bsd/file/dist/src/readelf.c   21 Sep 2022 19:32:32 -
>@@ -456,7 +456,11 @@ do_note_netbsd_version(struct magic_set 
> 
>   if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
>   return -1;
>-  if (ver_rel == 0 && ver_patch != 0) {
>+  if (ver_maj >= 9) {
>+  ver_patch += 100 * ver_rel;
>+  if (file_printf(ms, ".%u", ver_patch) == -1)
>+  return -1;
>+  } else if (ver_rel == 0 && ver_patch != 0) {
>   if (file_printf(ms, ".%u", ver_patch) == -1)
>   return -1;
>   } else if (ver_rel != 0) {
>
>% file /bin/ls
>/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
>dynamically linked, interpreter /libexec/ld.elf_so, for NetBSD 9.99.100,
>not stripped

Thanks, applied!

christos



re: 9.99.100 fallout: file(1)

2022-09-21 Thread matthew green
> However, I wonder why this kind of info is embedded in ELF files, what
> point does that have?   Maybe it would be better to have them just say
> x.99 (and forget the kernel ABI bump number) ?

i would rather keep the info.  i use it as a quick check of
whether i reinstalled recently or not.  "file /bin/sh".


.mrg.


Re: 9.99.100 fallout: file(1)

2022-09-21 Thread Michael van Elst
k...@munnari.oz.au (Robert Elz) writes:

>The way you have it coded, I suspect that 9.1 binaries will appear to
>be 9.1.0 instead (the ver_patch data is always appended for ver_maj >= 9).

True. Here is a patch that ignores a zero patch level.

Index: external/bsd/file/dist/src/readelf.c
===
RCS file: /cvsroot/src/external/bsd/file/dist/src/readelf.c,v
retrieving revision 1.25
diff -p -u -r1.25 readelf.c
--- external/bsd/file/dist/src/readelf.c9 Apr 2021 19:11:42 -   
1.25
+++ external/bsd/file/dist/src/readelf.c21 Sep 2022 23:17:49 -
@@ -456,7 +456,13 @@ do_note_netbsd_version(struct magic_set 
 
if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
return -1;
-   if (ver_rel == 0 && ver_patch != 0) {
+   if (ver_maj >= 9) {
+   ver_patch += 100 * ver_rel;
+   if (ver_patch != 0) {
+   if (file_printf(ms, ".%u", ver_patch) == -1)
+   return -1;
+   }
+   } else if (ver_rel == 0 && ver_patch != 0) {
if (file_printf(ms, ".%u", ver_patch) == -1)
return -1;
} else if (ver_rel != 0) {


>However, I wonder why this kind of info is embedded in ELF files, what
>point does that have?   Maybe it would be better to have them just say
>x.99 (and forget the kernel ABI bump number) ?

The note has little value, best it can do is identify from which
release the binary came, in case you have a mixed installation. And
then the full version number is required.



Re: 9.99.100 fallout: file(1)

2022-09-21 Thread Robert Elz
Date:Wed, 21 Sep 2022 19:33:47 - (UTC)
From:mlel...@serpens.de (Michael van Elst)
Message-ID:  

  | -   if (ver_rel == 0 && ver_patch != 0) {
  | +   if (ver_maj >= 9) {

I'd suggest instead
if (ver_min == 99) {

While this issue never happened with earlier NetBSDs there's no
real reason to exclude them from the possibility that it might have.

On the other hand, there's never been a version since we introduced the
.99 concept (NetBSD 2 going on to 3?) where x.99 had anything other than
a single decimal suffix.   And we never had, and I don't think anyone
expects that we ever will have, a N.9x version of NetBSD where x != 9).
That is, ver_min never has been, and never will be, 99, other than to
indicate "on the way to ver_maj + 1".

The way you have it coded, I suspect that 9.1 binaries will appear to
be 9.1.0 instead (the ver_patch data is always appended for ver_maj >= 9).

However, I wonder why this kind of info is embedded in ELF files, what
point does that have?   Maybe it would be better to have them just say
x.99 (and forget the kernel ABI bump number) ?

kre



Re: 9.99.100 fallout: file(1)

2022-09-21 Thread Michael van Elst
campbell+netbsd-tech-k...@mumble.net (Taylor R Campbell) writes:

>We appear to have revived the old alphanumeric versioning scheme,
>according to file(1)!  Someone needs to teach file(1) that this is
>9.99.100, not 9.99A(.0).

Index: external/bsd/file/dist/src/readelf.c
===
RCS file: /cvsroot/src/external/bsd/file/dist/src/readelf.c,v
retrieving revision 1.25
diff -p -u -r1.25 readelf.c
--- external/bsd/file/dist/src/readelf.c9 Apr 2021 19:11:42 -   
1.25
+++ external/bsd/file/dist/src/readelf.c21 Sep 2022 19:32:32 -
@@ -456,7 +456,11 @@ do_note_netbsd_version(struct magic_set 
 
if (file_printf(ms, " %u.%u", ver_maj, ver_min) == -1)
return -1;
-   if (ver_rel == 0 && ver_patch != 0) {
+   if (ver_maj >= 9) {
+   ver_patch += 100 * ver_rel;
+   if (file_printf(ms, ".%u", ver_patch) == -1)
+   return -1;
+   } else if (ver_rel == 0 && ver_patch != 0) {
if (file_printf(ms, ".%u", ver_patch) == -1)
return -1;
} else if (ver_rel != 0) {

% file /bin/ls
/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically 
linked, interpreter /libexec/ld.elf_so, for NetBSD 9.99.100, not stripped