<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - clang-format Bad Error Message on Segmentation Fault from Permission Error"
href="https://bugs.llvm.org/show_bug.cgi?id=49134">49134</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang-format Bad Error Message on Segmentation Fault from Permission Error
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Tooling
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>kkovacs@diconfiberoptics.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre># Overview:
clang-format crashed with a segfault + stack dump instead of reporting an
error.
# Steps to Reproduce:
I tried to run
clang-format-13 -i myfile.h
on a file that (not to my knowledge) had file mode 555 (read and execute only).
# Actual Results
I got this output:
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0. Program arguments: clang-format-13 -i
undocumentedSrc/standard_hal/stm32f4xx_hal_i2c.h
Stack dump without symbol names (ensure you have llvm-symbolizer in your
PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/usr/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x23)[0x7f00dc510943]
/usr/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7f00dc50ed40]
/usr/lib/x86_64-linux-gnu/libLLVM-13.so.1(+0xc00faf)[0x7f00dc510faf]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7f00e3ff2980]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang13DiagnosticIDs11ProcessDiagERNS_17DiagnosticsEngineE+0x2a7)[0x7f00e1860fd7]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang17DiagnosticsEngine21EmitCurrentDiagnosticEb+0x53)[0x7f00e185add3]
/usr/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang8Rewriter21overwriteChangedFilesEv+0x5bf)[0x7f00e2a05eff]
clang-format-13[0x4095bb]
clang-format-13[0x40752c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f00dabe1bf7]
clang-format-13[0x406e5a]
Segmentation fault (core dumped)
This raw stack dump error message is not clear, and it took me a long time to
figure out that this was a permissions issue.
# Expected Results
I should have gotten an error message saying something like "permission denied
for writing file myfile.h"
# Date and Hardware
Feb. 8, 2021 on Windows Subsystem for Linux, Windows 10</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>