Skip to content

[dsymutil] Fix assertion in the Reproducer/FileCollector when TMPDIR is empty #5614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
4 changes: 3 additions & 1 deletion llvm/lib/Support/FileCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ static bool isCaseSensitivePath(StringRef Path) {
}

FileCollector::FileCollector(std::string Root, std::string OverlayRoot)
: Root(std::move(Root)), OverlayRoot(std::move(OverlayRoot)) {
: Root(Root), OverlayRoot(OverlayRoot) {
assert(sys::path::is_absolute(Root) && "Root not absolute");
assert(sys::path::is_absolute(OverlayRoot) && "OverlayRoot not absolute");
}

void FileCollector::PathCanonicalizer::updateWithRealPath(
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/tools/dsymutil/X86/reproducer.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ RUN: cp %p/../Inputs/basic3.macho.x86_64.o %t/Inputs
# Verify all the files are present.
RUN: dsymutil -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s

# Make sure we don't crash with an empty TMPDIR.
RUN: env TMPDIR="" dsymutil -o -f -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1

# Create a reproducer.
RUN: env DSYMUTIL_REPRODUCER_PATH=%t.repro dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER
RUN: llvm-dwarfdump -a %t.generate | FileCheck %s
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/dsymutil/Reproducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static std::string createReproducerDir(std::error_code &EC) {
} else {
EC = sys::fs::createUniqueDirectory("dsymutil", Root);
}
sys::fs::make_absolute(Root);
return EC ? "" : std::string(Root);
}

Expand Down