Opened 6 years ago
Last modified 5 years ago
#58497 new enhancement
Don't check os_major on Linux
Reported by: | yan12125 (Chih-Hsuan Yen) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | base | Version: | |
Keywords: | Cc: | mojca (Mojca Miklavec) | |
Port: |
Description
I've just upgrade my server from Linux kernel 4.18.16 to kernel 5.1.2, and the port
command refuses to work:
Error: Current platform "linux 5" does not match expected platform "linux 4" Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration OS platform mismatch while executing "mportinit ui_options global_options global_variations" Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch
This check is not necessary on Linux IMO as programs compiled on Linux 4.x should work just fine on Linux 5.x. Need to change this line: https://github.com/macports/macports-base/blob/v2.5.4/src/macports1.0/macports.tcl#L703
Change History (7)
comment:1 Changed 6 years ago by raimue (Rainer Müller)
comment:2 Changed 6 years ago by yan12125 (Chih-Hsuan Yen)
Ah, great reminder!
The actual version to use might be much more complicated. For each Linux executable file, there is a tag .note.ABI-tag
indicating the minimum compatible kernel version. For example on my machine readelf --notes /opt/local/libexec/macports/bin/tclsh8.5
gives the following info: (excerpted)
Displaying notes found in: .note.ABI-tag Owner Data size Description GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 3.2.0
There are some challenges:
- The ABI tag version might be lower than the running kernel. For example I got 3.2.0 even if I built macports on kernel 4.x.
- Different executables can have different version tags. For example, programmers can specify it via an assembly file (1).
Maybe the most accurate approach needs scanning files. That sounds too complicated. I would prefer a simpler way - change most (if not all) checks around os_major from != to >= for Linux.
(1) https://github.com/qt/qtbase/blob/5.12/src/corelib/global/minimum-linux.S
comment:3 Changed 5 years ago by mojca (Mojca Miklavec)
Cc: | mojca added |
---|
comment:4 Changed 5 years ago by mojca (Mojca Miklavec)
Unless we provide accurate information and implement this properly (which is unlikely to happen), we could either disable version checks, remove the version from Linux altogether (this is probably used in way too many places to get them all correct), or always set the version to "1".
I don't know all the details, but kernel version sounds a pretty useless metric, it's usually glibc that governs compatibility, and portfiles cannot do any sane checks on linux version anyway..
comment:5 Changed 5 years ago by Satryaji Aulia <satraul@…>
comment:6 Changed 5 years ago by yan12125 (Chih-Hsuan Yen)
Thank you Satryaji Aulia! Just wondering - is there a reason to call the commit "temporary"?
comment:7 Changed 5 years ago by mojca (Mojca Miklavec)
At the moment one probably still needs two different portindex files to be generated on the server, and it might be that all ports will be rebuilt as they contain a hardcoded version in the binary archives. So maybe this needs to be changed at other locations, or handled in some different way.
Changing just this one line will not help much, as the installed ports also store the platform information in the registry and will all be considered outdated. I guess the real fix would be not to store the Linux kernel version in
os_major
, but I am also not sure what else to use.