Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,8 @@ def _uname_info(self) -> Dict[str, str]:

@staticmethod
def _parse_uname_content(lines: Sequence[str]) -> Dict[str, str]:
if not lines:
return {}
props = {}
match = re.search(r"^([^\s]+)\s+([\d\.]+)", lines[0].strip())
if match:
Expand Down
3 changes: 3 additions & 0 deletions tests/resources/testdistros/distro/emptyuname/bin/uname
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo -n
8 changes: 8 additions & 0 deletions tests/test_distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,14 @@ def test_bad_uname(self):
assert self.distro.uname_attr("name") == ""
assert self.distro.uname_attr("release") == ""

def test_empty_uname(self):
self._setup_for_distro(os.path.join(TESTDISTROS, "distro", "emptyuname"))
self.distro = distro.LinuxDistribution()

assert self.distro.uname_attr("id") == ""
assert self.distro.uname_attr("name") == ""
assert self.distro.uname_attr("release") == ""

def test_usrlibosreleaseonly(self):
self._setup_for_distro(
os.path.join(TESTDISTROS, "distro", "usrlibosreleaseonly")
Expand Down