<div dir="ltr">Package: lsb-release<br>Version: 11.1.0<br><br>There is a bug with lsb_release in that it does not check for the existence of apt-cache before it tries to execute it. If apt-cache is not present on the system this will result in the following error:<br><br>[  111s] Traceback (most recent call last):<br>[  111s]   File "/usr/bin/lsb_release", line 95, in <module><br>[  111s]     main()<br>[  111s]   File "/usr/bin/lsb_release", line 59, in main<br>[  111s]     distinfo = lsb_release.get_distro_information()<br>[  111s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 356, in get_distro_information<br>[  111s]     distinfo = guess_debian_release()<br>[  111s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 290, in guess_debian_release<br>[  111s]     rinfo = guess_release_from_apt()<br>[  111s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 195, in guess_release_from_apt<br>[  111s]     releases = parse_apt_policy()<br>[  111s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 178, in parse_apt_policy<br>[  111s]     close_fds=True).communicate()[0].decode('utf-8')<br>[  111s]   File "/usr/lib/python3.7/subprocess.py", line 800, in __init__<br>[  111s]     restore_signals, start_new_session)<br>[  111s]   File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child<br>[  111s]     raise child_exception_type(errno_num, err_msg, err_filename)<br>[  111s] FileNotFoundError: [Errno 2] No such file or directory: 'apt-cache': 'apt-cache'<br>[  112s] Traceback (most recent call last):<br>[  112s]   File "/usr/bin/lsb_release", line 95, in <module><br>[  112s]     main()<br>[  112s]   File "/usr/bin/lsb_release", line 59, in main<br>[  112s]     distinfo = lsb_release.get_distro_information()<br>[  112s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 356, in get_distro_information<br>[  112s]     distinfo = guess_debian_release()<br>[  112s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 290, in guess_debian_release<br>[  112s]     rinfo = guess_release_from_apt()<br>[  112s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 195, in guess_release_from_apt<br>[  112s]     releases = parse_apt_policy()<br>[  112s]   File "/usr/lib/python3/dist-packages/lsb_release.py", line 178, in parse_apt_policy<br>[  112s]     close_fds=True).communicate()[0].decode('utf-8')<br>[  112s]   File "/usr/lib/python3.7/subprocess.py", line 800, in __init__<br>[  112s]     restore_signals, start_new_session)<br>[  112s]   File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child<br>[  112s]     raise child_exception_type(errno_num, err_msg, err_filename)<br>[  112s] FileNotFoundError: [Errno 2] No such file or directory: 'apt-cache': 'apt-cache'<br><div><br></div><div>The line that attempts to run apt-cache is this one:<br></div><div><a href="https://salsa.debian.org/debian/lsb/blob/debian/master/lsb_release.py#L174">https://salsa.debian.org/debian/lsb/blob/debian/master/lsb_release.py#L174</a></div><div><br></div><div>I would suggest a check is added to see if apt-cache exists on the system, and if not that check is bypassed. Possibly<span class="gmail-n"> a check such as: if shutil</span><span class="gmail-o">.</span><span class="gmail-n">which</span><span class="gmail-p">(</span><span class="gmail-s2">"apt-cache"</span><span class="gmail-p">) != None:<br></span></div><div><span class="gmail-p"><br></span></div><div><span class="gmail-p">This seems like a straightforward check, currently lsb_release does not work at all on systems without apt-cache, such as those used by the Open Build Service.</span></div><div><span class="gmail-p"><br></span></div><div><span class="gmail-p">This appears to be present on all versions of lsb_release since at least 10.2019031300, I'm not sure if it is in older versions as well.<br></span></div></div>