[Gambas-user] getting Gambas version info across devices

Bruce Steers bsteers4 at gmail.com
Thu Mar 25 17:37:18 CET 2021


ELF could work i think as i have readelf command.

but a bit of a needle in a haystack. Not sure where to look for the
version/trunk info.


Best i have come up with is this terrible awful , almost disgraceful hack
using the command strings.
"terrible but it works" ;)

    Dim sCli, sVer As String

        Shell "strings " & sDrive &/ "usr/bin/gbc3 | grep '3.'" Wait To sCli
        Dim sVar As String[] = Split(sCli, "\n")
        Dim c As Integer = sVar.Find("gbc3: start task: [%d] '%s'")
        While Left(sVer, 2) <> "3." And c < sVar2.Count
        Inc c
        sVer = sVar2[c]
        Wend

Hack , some might say.
Luck , could also be true.

whatever you cal it i'm now 10 out of 10 on getting it right ,,,, wrongly
;) lol


But the ELF way looks to be the way if only you know what to look for (and
i don't :( )

BruceS


On Mon, 22 Mar 2021 at 23:17, Bruce <adamnt42 at gmail.com> wrote:

> On 23/3/21 9:22 am, Benoît Minisini wrote:
> > Le 22/03/2021 à 23:37, Bruce Steers a écrit :
> >> What about that env arg that sets libdir, would that work?
> >>
> >> Cheers
> >> BruceS
> >>
> >
> > Normally 'chroot' should be enough, has 'gbc3' depends on the following
> > libs only:
> >
> > linux-vdso.so.1 (0x00007ffee277d000)
> > libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa6a6e86000)
> > libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa6a6d37000)
> > /lib64/ld-linux-x86-64.so.2 (0x00007fa6a70f1000)
> >
> > you can hardly use less.
> >
>
> Even atthat low a level I don;t think you can get a guarantee that
> "that" version library works properly on "this" kernel. Also, if "that"
> version changes (distro glibc upgrade) then possible instability can ensue.
>
> It's probably a waste of your time, B, but there is documentation of the
> ELF file header around which could give you an offset into the file
> where the version is stored. Sadly though there is no guarantee that all
> distros use the suggested convention.
>
> b
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210325/249ff3c3/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snap.png
Type: image/png
Size: 179824 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210325/249ff3c3/attachment-0001.png>


More information about the User mailing list