[llvm-bugs] [Bug 49134] New: clang-format Bad Error Message on Segmentation Fault from Permission Error

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 10 16:51:38 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49134

            Bug ID: 49134
           Summary: clang-format Bad Error Message on Segmentation Fault
                    from Permission Error
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Tooling
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kkovacs at diconfiberoptics.com
                CC: llvm-bugs at lists.llvm.org

# 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 https://bugs.llvm.org/ 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210211/660e541c/attachment.html>


More information about the llvm-bugs mailing list