[CWB] Segmentation fault

Hardie, Andrew a.hardie at lancaster.ac.uk
Tue May 5 10:27:20 CEST 2020


New logic, pseudocode, with checks in order of reliability:  (1) distro-specficic version files; (2) lsb_release; (3) /etc/os-release; (4) /etc/lsb-release

If file exists "/etc/debian-release"
	then os = debian
else if file exists "/etc/alpine-version"
	then os = alpine
else if file exists "/etc/fedora-release"
	then os = fedora
else if file exists "/etc/redhat-release"
	then os = centos
else if file exists "/etc/SUSE-brand"
	then os = suse
else if program exists lsb_release
	then os = `lsb_release -is`
else if file exists "/etc/os-release"
	then source /etc/os-release ; os = $ID
else if file exists "/etc/lsb-release"
	then source /etc/lsb-release ; os = $DISTRIB_ID
fi

case os
	(set the VER, INSTALLER, PACKAGES variables on the basis of the string deduced above)
esac

============================

It will also be necessary to lowercase everything since some of the above ways of getting the distro id use all-lowercase, and some don't. 

(Thanks to Maarten for the suggestion on the (open)SUSE packaging system with zypper; if anyone knows the ins and outs of pacman for Arch Linux, or any other significant distro, suggestions are welcome.)

STEFAN: If this sounds OK, I'll code it up as soon as I get a moment. 

Re: >>> I'm still worried by the dependence on specific library versions that keep changing between Linux releases.  Doesn't Linux have a more stable way of finding packages?

Depending on the distro, ... maybe. Debian/Ubuntu have "virtual packages" - empty packages that depend on the most recent version of X. However, as far I can see, they DON'T use this for major version changes, I believe because the thinking is you might want to have more than one installed at once. So the "python" package is still python2 and there is a separate "python3" and no virtual package which says "the latest python please". Same for libreadline: debian buster has both libreadline5 and libreadline7. 

libreadline-dev IS libreadline7-dev - it succeeds and replaces libreadline5-dev and libreadline6-dev. The lack of number hopefully expresses the Debian people's desire not to change the name on upgrade to 8 and beyond!

best

Andrew.


-----Original Message-----
From: cwb-bounces at sslmit.unibo.it <cwb-bounces at sslmit.unibo.it> On Behalf Of Stefan Evert
Sent: 04 May 2020 19:59
To: CWBdev Mailing List <cwb at sslmit.unibo.it>
Subject: Re: [CWB] Segmentation fault


> The logic is wrong - the first two bits should be exchanged: the /etc/lsb-release check is combined with the section for “without lsb_release”, which is probably where some of those things go wrong. But yes, I would say just not specifying version numbers would be most recommendable…

The comments are correct: the branch with /etc/lsb-release is taken because it works on old system that don't have the lsb_release command-line utility.

But the deeper logic is wrong because it takes the old branch on newer systems that still have /etc/lsb-release.  So the script should test whether a program "lsb_release" can be run first, but the author probably didn't know how to do that safely.

I'm still worried by the dependence on specific library versions that keep changing between Linux releases.  Doesn't Linux have a more stable way of finding packages?
	
Best,
Stefan
_______________________________________________
CWB mailing list
CWB at sslmit.unibo.it


More information about the CWB mailing list