immunant / c2rust

Migrate C code to Rust
https://c2rust.com/
Other
3.81k stars 220 forks source link

Improve Fedora detection #963

Closed mjgarton closed 1 year ago

mjgarton commented 1 year ago

Instead of relying on $NAME, which has changed in recent releases, use $ID, which appears more stable.

mjgarton commented 1 year ago

It seems that only Fedora has changed the NAME value. The others have all remained the same for a long time. I ran the following to check a few distros, in case you want to quickly check this yourself:

IMAGES="debian:7 debian:8 debian:9 debian:10 debian:11 debian:12 \
    ubuntu:12.04 ubuntu:12.10 ubuntu:13.04 ubuntu:13.10 ubuntu:14.04 ubuntu:14.10 ubuntu:15.04 ubuntu:15.10 ubuntu:16.04 ubuntu:16.10 \
        ubuntu:17.04 ubuntu:17.10 ubuntu:18.04 ubuntu:18.10 ubuntu:19.04 ubuntu:19.10 ubuntu:20.04 ubuntu:20.10 ubuntu:21.04 ubuntu:21.10 ubuntu:22.04 \
    fedora:20 fedora:21 fedora:22 fedora:23 fedora:24 fedora:25 fedora:26 fedora:27 fedora:28 fedora:29 fedora:30 fedora:31 fedora:32 fedora:33 fedora:34 fedora:35 fedora:36 fedora:37 fedora:38"

for i in $IMAGES; do
    echo -n  $i :
    docker run $i grep ^NAME= /etc/os-release
done

for i in $IMAGES; do
    echo -n  $i :
    docker run $i grep ^ID= /etc/os-release
done