Skip to content

Conversation

@UzixLS
Copy link

@UzixLS UzixLS commented Nov 29, 2025

It fails on windows 10 otherwise with:

Traceback (most recent call last):
 ...
  File "C:\Dev\LLVM\lib\libscanbuild\analyze.py", line 567, in
report_failure
    handle.write(" ".join(os.uname()) + os.linesep)
                          ^^^^^^^^
AttributeError: module 'os' has no attribute 'uname'. Did you mean:
'name'?

There was also a problem identifying the actual compiler on Windows because the program name have an ".exe" suffix.

It fails on windows 10 otherwise with:
```
Traceback (most recent call last):
 ...
  File "C:\Dev\LLVM\lib\libscanbuild\analyze.py", line 567, in
report_failure
    handle.write(" ".join(os.uname()) + os.linesep)
                          ^^^^^^^^
AttributeError: module 'os' has no attribute 'uname'. Did you mean:
'name'?
```

There was also a problem identifying the actual compiler on Windows
because the program name have an ".exe" suffix.
@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the clang Clang issues not falling into any other category label Nov 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 29, 2025

@llvm/pr-subscribers-clang

Author: Eugene Lozovoy (UzixLS)

Changes

It fails on windows 10 otherwise with:

Traceback (most recent call last):
 ...
  File "C:\Dev\LLVM\lib\libscanbuild\analyze.py", line 567, in
report_failure
    handle.write(" ".join(os.uname()) + os.linesep)
                          ^^^^^^^^
AttributeError: module 'os' has no attribute 'uname'. Did you mean:
'name'?

There was also a problem identifying the actual compiler on Windows because the program name have an ".exe" suffix.


Full diff: https://github.com/llvm/llvm-project/pull/169976.diff

2 Files Affected:

  • (modified) clang/tools/scan-build-py/lib/libscanbuild/analyze.py (+2-1)
  • (modified) clang/tools/scan-build-py/lib/libscanbuild/compilation.py (+1-1)
diff --git a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
index 72aac8f545240..91d3089154a9d 100644
--- a/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
+++ b/clang/tools/scan-build-py/lib/libscanbuild/analyze.py
@@ -23,6 +23,7 @@
 import datetime
 import shutil
 import glob
+import platform
 from collections import defaultdict
 
 from libscanbuild import (
@@ -563,7 +564,7 @@ def destination():
         handle.write(opts["file"] + os.linesep)
         handle.write(error.title().replace("_", " ") + os.linesep)
         handle.write(" ".join(cmd) + os.linesep)
-        handle.write(" ".join(os.uname()) + os.linesep)
+        handle.write(" ".join(platform.uname()) + os.linesep)
         handle.write(get_version(opts["clang"]))
         handle.close()
     # write the captured output too
diff --git a/clang/tools/scan-build-py/lib/libscanbuild/compilation.py b/clang/tools/scan-build-py/lib/libscanbuild/compilation.py
index 6b9e3cabae309..e1226b338ff35 100644
--- a/clang/tools/scan-build-py/lib/libscanbuild/compilation.py
+++ b/clang/tools/scan-build-py/lib/libscanbuild/compilation.py
@@ -135,7 +135,7 @@ def compiler_language(command):
     cplusplus = re.compile(r"^(.+)(\+\+)(-.+|)$")
 
     if command:
-        executable = os.path.basename(command[0])
+        executable = os.path.basename(command[0]).removesuffix('.exe')
         if any(pattern.match(executable) for pattern in COMPILER_PATTERNS):
             return "c++" if cplusplus.match(executable) else "c"
     return None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants