Skip to content

Commit

Permalink
pack: Restore behavior with no passed trace dirs
Browse files Browse the repository at this point in the history
This is a bit of an embarassing bug-fix, but as pointed out in
#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.
  • Loading branch information
Keno committed Oct 1, 2024
1 parent 6fba2e2 commit e67c1ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PackCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,11 @@ int PackCommand::run(vector<string>& args) {
trace_dirs.push_back(trace_dir);
}

// If no trace dirs were supplied, default to packing "", i.e. the latest trace.
if (trace_dirs.empty()) {
trace_dirs.push_back("");
}

return pack(trace_dirs, flags);
}

Expand Down
5 changes: 5 additions & 0 deletions src/test/pack.run
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ pack || failed "'rr pack' failed"
if [[ `ls latest-trace/*_pack$bitness-* | wc -l` != "1" ]]; then
failed "Failed to coalesce all instances of 'pack'"
fi

if [[ `ls latest-trace/mmap_pack_* | wc -l` == "0" ]]; then
failed "Packing produced no files."
fi

# If there are no copies of _mapped_file it was probably copied
# into the trace data, for one of various reasons, so don't fail
# the test in that case.
Expand Down

0 comments on commit e67c1ec

Please sign in to comment.