question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Encourage using feature detection instead of distro name/version

See original GitHub issue

Hello! I’m the person responsible for dropping platform.linux_distrubution from Python 3.8. We’re now recommending distro instead. Thank you for all the work going into this module – it’s certainly useful in certain cases, like finding out what to put in a log or problem report.

However, think that distro’s docs should include a warning against using it for decisions, because a platform’s name is not a good indicator of what is possible on it.

Once people apply custom workarounds for Ubuntu (and use distro info for that), less popular derivatives like Linux Mint will need to report themselves as Ubuntu to get those workarounds. That then leads to the need for better distro reporting tools, like this one… which then leads to more distro-specific workarounds. It’s a vicious circle.

It’s the same problem as “browser sniffing” in the web world, where modern “user agent” strings contain mostly lies:

Mozilla/5.0 (Linux; Android 4.4.2); Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Mobile Safari/537.36 OPR/20.0.1396.72047

You’ll find warnings against using browser-agent in any respectable recent documentation on the topic.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
encukoucommented, Apr 12, 2019

Sorry for the delay. Would the following work for the documentation, under Overview and motivation?

Preferring feature detection

Information from this package is useful for logging and problem reporting.

However, it is usually a bad idea to base automated decisions on the information. Instead, try to use feature detection. If you need to install packages, look for yum vs. apt-get commands, if you need a specific version of glibc, query the library version directly, and so on.

If people use distro to apply custom workarounds for, say, Ubuntu, less popular derivatives like Linux Mint will need to report themselves as Ubuntu to get those workarounds. That then leads to the need for more powerful distro reporting tools, which then leads to more distro-specific workarounds, and more distros needing to pose as other distros to get the workarounds. Please, do not feed the vicious circle.

1reaction
basakcommented, Oct 8, 2018

I just mentioned it as an example of how the problem is solved today. I didn’t intend to suggest that you used that as-is. But os-release does have ID_LIKE, which provides the information you need to implement something similar. I think you could implement a “am I like X” function using that data.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · python-distro/distro - GitHub
python-distro / distro Public ... Encourage using feature detection instead of distro name/version area: docs discussion needed enhancement.
Read more >
Implementing feature detection - Learn web development | MDN
Feature detection involves working out whether a browser supports a certain block of code, and running different code depending on whether it ...
Read more >
User-agent string changes | Hacker News
Feature detection is a major step forward HOWEVER sometimes a feature is "supported" but has different incompatible behaviour between browser A ...
Read more >
Platform GPL6480 - GEO Accession viewer - NIH
A different version of this platform with the Agilent Feature Extraction feature numbers in the ID column is assigned accession number ...
Read more >
FPGuard: Detection and Prevention of Browser Fingerprinting
In case a document exceeds the limit, Tor does not allow the website to load more fonts. This ultimately reduces the functionality of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found