Comment 17 for bug 792146

Revision history for this message
In , Anders Kaseorg (andersk) wrote :

Looking at current trunk, it looks like something was done about the hardcoded list of gcc versions:
http://llvm.org/viewvc/llvm-project?view=rev&revision=143874

However, nothing has been done about the hardcoded list of distros and distro release files. There is still

enum LinuxDistro {
  ArchLinux,
  DebianLenny,
  DebianSqueeze,
  DebianWheezy,
  Exherbo,
  RHEL4,
  RHEL5,
  RHEL6,
  Fedora13,
  Fedora14,
  Fedora15,
  FedoraRawhide,
  OpenSuse11_3,
  OpenSuse11_4,
  OpenSuse12_1,
  UbuntuHardy,
  UbuntuIntrepid,
  UbuntuJaunty,
  UbuntuKarmic,
  UbuntuLucid,
  UbuntuMaverick,
  UbuntuNatty,
  UbuntuOneiric,
  UnknownDistro
};

along with code to parse /etc/lsb-release, /etc/redhat-release, /etc/debian_version, /etc/SuSE-release, /etc/exherbo-release, and /etc/arch-release to detect which of these distros is running. This code automatically breaks every six months when Ubuntu and Fedora both release another version. (For example, Ubuntu has a new Precise Pangolin development release, and Fedora released Fedora 16 as stable. Even Debian squeeze released, so its /etc/debian_version looks like ‘6.0.3’ instead of ‘squeeze/sid’ now and DetectLinuxDistro() misdetects it.)

Maybe a stopgap solution would be to treat unknown Ubuntu releases as UbuntuOneiric, unknown Fedora releases as FedoraRawhide, etc. instead of categorizing all distros from the future as UnknownDistro. But I think the entire idea of looking at /etc/*-release files to guess the right linker flags is a violation of abstraction.