Skip to content

Commit e67c1ec

Browse files
committed
pack: Restore behavior with no passed trace dirs
This is a bit of an embarassing bug-fix, but as pointed out in rr-debugger#3834 (comment), I accidentally broke `rr pack` without trace dir specified (which is supposed to pack the latest dir). We do actually have a test for it, which does fail for me locally (which I didn't notice - sorry), but not on CI. I'm not entirely sure why it doesn't fail on CI, but I imagine we might be copying more things in the CI environment, rather than cloning/linking them. To try to catch similar regressions in the future, this also adds an extra check to the test to make sure that there is some `mmap_pack_*` file in the trace after packing. I think we should always be packing at least libc or ld-linux, so hopefully there shouldn't be any false positives there.
1 parent 6fba2e2 commit e67c1ec

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/PackCommand.cc

+5
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,11 @@ int PackCommand::run(vector<string>& args) {
754754
trace_dirs.push_back(trace_dir);
755755
}
756756

757+
// If no trace dirs were supplied, default to packing "", i.e. the latest trace.
758+
if (trace_dirs.empty()) {
759+
trace_dirs.push_back("");
760+
}
761+
757762
return pack(trace_dirs, flags);
758763
}
759764

src/test/pack.run

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ pack || failed "'rr pack' failed"
1212
if [[ `ls latest-trace/*_pack$bitness-* | wc -l` != "1" ]]; then
1313
failed "Failed to coalesce all instances of 'pack'"
1414
fi
15+
16+
if [[ `ls latest-trace/mmap_pack_* | wc -l` == "0" ]]; then
17+
failed "Packing produced no files."
18+
fi
19+
1520
# If there are no copies of _mapped_file it was probably copied
1621
# into the trace data, for one of various reasons, so don't fail
1722
# the test in that case.

0 commit comments

Comments
 (0)