[libc-commits] [libc] [libc] Implement basename and dirname in libgen.h (PR #204554)

LLVM Continuous Integration via libc-commits libc-commits at lists.llvm.org
Fri Jun 19 08:56:23 PDT 2026


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `libc-x86_64-debian-dbg-asan` running on `libc-x86_64-debian` while building `libc` at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/147/builds/46469

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcBasenameTest.MultipleSlashes (3 us)
[ RUN      ] LlvmLibcBasenameTest.SimpleName
[       OK ] LlvmLibcBasenameTest.SimpleName (3 us)
[ RUN      ] LlvmLibcBasenameTest.SimpleNameTrailingSlash
[       OK ] LlvmLibcBasenameTest.SimpleNameTrailingSlash (3 us)
[ RUN      ] LlvmLibcBasenameTest.ComplexPath
[       OK ] LlvmLibcBasenameTest.ComplexPath (4 us)
Ran 9 tests.  PASS: 9  FAIL: 0
[458/4267] Linking CXX executable libc/test/src/libgen/libc.test.src.libgen.dirname_test.__unit__.__build__
[459/4267] Running unit test libc.test.src.libgen.basename_death_test.__unit__
FAILED: libc/test/src/libgen/CMakeFiles/libc.test.src.libgen.basename_death_test.__unit__ /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen/CMakeFiles/libc.test.src.libgen.basename_death_test.__unit__ 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen/libc.test.src.libgen.basename_death_test.__unit__.__build__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcBasenameTest.ModifyReturnValue
AddressSanitizer:DEADLYSIGNAL
=================================================================
==47663==ERROR: AddressSanitizer: SEGV on unknown address 0x561e35e2dda0 (pc 0x561e35dcfdce bp 0x7ffeaa1a45f0 sp 0x7ffeaa1a45d0 T0)
==47663==The signal is caused by a WRITE memory access.
    #0 0x561e35dcfdce in LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0::operator()() const /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20:3
    #1 0x561e35dcfd58 in __llvm_libc_20_0_0_git::testutils::FunctionCaller* __llvm_libc_20_0_0_git::testing::Test::createCallable<LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0>(LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0)::Callable::operator()() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:219:36
    #2 0x561e35dd59cd in __llvm_libc_20_0_0_git::testutils::invoke_in_subprocess(__llvm_libc_20_0_0_git::testutils::FunctionCaller*, int) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/ExecuteFunctionUnix.cpp:54:5
    #3 0x561e35dd40e1 in __llvm_libc_20_0_0_git::testing::Test::testProcessKilled(__llvm_libc_20_0_0_git::testutils::FunctionCaller*, int, char const*, char const*, __llvm_libc_20_0_0_git::testing::internal::Location) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcDeathTestExecutors.cpp:29:7
    #4 0x561e35dcf833 in LlvmLibcBasenameTest_ModifyReturnValue::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20:3
    #5 0x561e35dd7617 in __llvm_libc_20_0_0_git::testing::Test::runTests(__llvm_libc_20_0_0_git::testing::TestOptions const&) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:165:8
    #6 0x561e35e15d48 in main /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTestMain.cpp:59:10
    #7 0x7fa24c965249  (/lib/x86_64-linux-gnu/libc.so.6+0x27249) (BuildId: 93ac61ec5a8eb1396f9fbd350e3169a558528a40)
    #8 0x7fa24c965304 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x27304) (BuildId: 93ac61ec5a8eb1396f9fbd350e3169a558528a40)
    #9 0x561e35d0f3e0 in _start (/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen/libc.test.src.libgen.basename_death_test.__unit__.__build__+0x253e0) (BuildId: 7e227503e0434e4a2630a7cc4d4cbb68126e10c9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20:3 in LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0::operator()() const
==47663==ABORTING
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20: FAILURE
Expected [r]() { r[0] = 'a'; } to be killed by a signal
But it exited normally!
[  FAILED  ] LlvmLibcBasenameTest.ModifyReturnValue
Ran 1 tests.  PASS: 0  FAIL: 1
[460/4267] Linking CXX executable libc/test/src/fenv/libc.test.src.fenv.feenableexcept_test.__build__
[461/4267] Running unit test libc.test.src.libgen.dirname_test.__unit__
[==========] Running 11 tests from 1 test suite.
[ RUN      ] LlvmLibcDirnameTest.NullPointer
[       OK ] LlvmLibcDirnameTest.NullPointer (7 us)
[ RUN      ] LlvmLibcDirnameTest.EmptyString
[       OK ] LlvmLibcDirnameTest.EmptyString (6 us)
[ RUN      ] LlvmLibcDirnameTest.RegularPath
[       OK ] LlvmLibcDirnameTest.RegularPath (7 us)
[ RUN      ] LlvmLibcDirnameTest.TrailingSlash
[       OK ] LlvmLibcDirnameTest.TrailingSlash (6 us)
[ RUN      ] LlvmLibcDirnameTest.SingleSlash
Step 7 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[       OK ] LlvmLibcBasenameTest.MultipleSlashes (3 us)
[ RUN      ] LlvmLibcBasenameTest.SimpleName
[       OK ] LlvmLibcBasenameTest.SimpleName (3 us)
[ RUN      ] LlvmLibcBasenameTest.SimpleNameTrailingSlash
[       OK ] LlvmLibcBasenameTest.SimpleNameTrailingSlash (3 us)
[ RUN      ] LlvmLibcBasenameTest.ComplexPath
[       OK ] LlvmLibcBasenameTest.ComplexPath (4 us)
Ran 9 tests.  PASS: 9  FAIL: 0
[458/4267] Linking CXX executable libc/test/src/libgen/libc.test.src.libgen.dirname_test.__unit__.__build__
[459/4267] Running unit test libc.test.src.libgen.basename_death_test.__unit__
FAILED: libc/test/src/libgen/CMakeFiles/libc.test.src.libgen.basename_death_test.__unit__ /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen/CMakeFiles/libc.test.src.libgen.basename_death_test.__unit__ 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen/libc.test.src.libgen.basename_death_test.__unit__.__build__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcBasenameTest.ModifyReturnValue
AddressSanitizer:DEADLYSIGNAL
=================================================================
==47663==ERROR: AddressSanitizer: SEGV on unknown address 0x561e35e2dda0 (pc 0x561e35dcfdce bp 0x7ffeaa1a45f0 sp 0x7ffeaa1a45d0 T0)
==47663==The signal is caused by a WRITE memory access.
    #0 0x561e35dcfdce in LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0::operator()() const /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20:3
    #1 0x561e35dcfd58 in __llvm_libc_20_0_0_git::testutils::FunctionCaller* __llvm_libc_20_0_0_git::testing::Test::createCallable<LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0>(LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0)::Callable::operator()() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:219:36
    #2 0x561e35dd59cd in __llvm_libc_20_0_0_git::testutils::invoke_in_subprocess(__llvm_libc_20_0_0_git::testutils::FunctionCaller*, int) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/ExecuteFunctionUnix.cpp:54:5
    #3 0x561e35dd40e1 in __llvm_libc_20_0_0_git::testing::Test::testProcessKilled(__llvm_libc_20_0_0_git::testutils::FunctionCaller*, int, char const*, char const*, __llvm_libc_20_0_0_git::testing::internal::Location) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcDeathTestExecutors.cpp:29:7
    #4 0x561e35dcf833 in LlvmLibcBasenameTest_ModifyReturnValue::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20:3
    #5 0x561e35dd7617 in __llvm_libc_20_0_0_git::testing::Test::runTests(__llvm_libc_20_0_0_git::testing::TestOptions const&) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:165:8
    #6 0x561e35e15d48 in main /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTestMain.cpp:59:10
    #7 0x7fa24c965249  (/lib/x86_64-linux-gnu/libc.so.6+0x27249) (BuildId: 93ac61ec5a8eb1396f9fbd350e3169a558528a40)
    #8 0x7fa24c965304 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x27304) (BuildId: 93ac61ec5a8eb1396f9fbd350e3169a558528a40)
    #9 0x561e35d0f3e0 in _start (/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/libgen/libc.test.src.libgen.basename_death_test.__unit__.__build__+0x253e0) (BuildId: 7e227503e0434e4a2630a7cc4d4cbb68126e10c9)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20:3 in LlvmLibcBasenameTest_ModifyReturnValue::Run()::$_0::operator()() const
==47663==ABORTING
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/libgen/basename_death_test.cpp:20: FAILURE
Expected [r]() { r[0] = 'a'; } to be killed by a signal
But it exited normally!
[  FAILED  ] LlvmLibcBasenameTest.ModifyReturnValue
Ran 1 tests.  PASS: 0  FAIL: 1
[460/4267] Linking CXX executable libc/test/src/fenv/libc.test.src.fenv.feenableexcept_test.__build__
[461/4267] Running unit test libc.test.src.libgen.dirname_test.__unit__
[==========] Running 11 tests from 1 test suite.
[ RUN      ] LlvmLibcDirnameTest.NullPointer
[       OK ] LlvmLibcDirnameTest.NullPointer (7 us)
[ RUN      ] LlvmLibcDirnameTest.EmptyString
[       OK ] LlvmLibcDirnameTest.EmptyString (6 us)
[ RUN      ] LlvmLibcDirnameTest.RegularPath
[       OK ] LlvmLibcDirnameTest.RegularPath (7 us)
[ RUN      ] LlvmLibcDirnameTest.TrailingSlash
[       OK ] LlvmLibcDirnameTest.TrailingSlash (6 us)
[ RUN      ] LlvmLibcDirnameTest.SingleSlash

```

</details>

https://github.com/llvm/llvm-project/pull/204554


More information about the libc-commits mailing list