Skip to content

user-provided comparison function does not correctly implement a total order #1617

@ppwwyyxx

Description

@ppwwyyxx

Description of the bug

 $ RUST_BACKTRACE=full git test run -x ls 
The application panicked (crashed).
Message:  user-provided comparison function does not correctly implement a total order
Location: library/core/src/slice/sort/shared/smallsort.rs:865

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   0: git_branchless_test::subcommand_run with effects=<Output fancy=false> git_run_info=<GitRunInfo path_to_git="git" working_directory="/xxx" env=not shown> options=RawTestOptions { exec: Some("ls"), command: None, dry_run: false, strategy: None, search: None, bisect: false, no_cache: false, interactive: false, jobs: None, verbosity: None, apply_fixes: false } revset=Revset("stack() | @") resolve_revset_options=ResolveRevsetOptions { show_hidden_commits: false } move_options=None
      at /home/xxx/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/git-branchless-test-0.10.0/src/lib.rs:566
       564 │
       565 │ /// Run the command provided in `options` on each of the commits in `revset`.
       566 > #[instrument]
       567 │ fn subcommand_run(
       568 │     effects: &Effects,
   1: git_branchless_test::command_main with ctx=CommandContext { effects: <Output fancy=false>, git_run_info: <GitRunInfo path_to_git="git" working_directory="/home/xxxx" env=not shown> } args=TestArgs { subcommand: Run { exec: Some("ls"), command: None, revset: Revset("stack() | @"), resolve_revset_options: ResolveRevsetOptions { show_hidden_commits: false }, verbosity: 0, strategy: None, search: None, bisect: false, no_cache: false, interactive: false, jobs: None } }
      at /home/xxx/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/git-branchless-test-0.10.0/src/lib.rs:460
       458 │
       459 │ /// `test` command.
       460 > #[instrument]
       461 │ pub fn command_main(ctx: CommandContext, args: TestArgs) -> EyreExitOr<()> {
       462 │     let CommandContext {

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮
   8: core::slice::sort::shared::smallsort::panic_on_ord_violation::hf83ec1dc4f8ed101
      at <unknown source file>:<unknown line>
   9: core::slice::sort::shared::smallsort::small_sort_general_with_scratch::he1c05ba5b21bb76b
      at <unknown source file>:<unknown line>
  10: core::slice::sort::stable::quicksort::quicksort::hf6c9203a72887cdc
      at <unknown source file>:<unknown line>
  11: core::slice::sort::stable::drift::sort::ha2db464023411c6d
      at <unknown source file>:<unknown line>
  12: core::slice::sort::stable::driftsort_main::he6ec68ebba2de07d
      at <unknown source file>:<unknown line>
  13: branchless::core::dag::sorted_commit_set::h5ea2544e71b6f338
      at <unknown source file>:<unknown line>
  14: git_branchless_test::subcommand_run::h7757a481a3978083
      at <unknown source file>:<unknown line>
  15: git_branchless_test::command_main::h3afd15b0fbf30e79
      at <unknown source file>:<unknown line>
  16: git_branchless_invoke::do_main_and_drop_locals::h7a56e8e3d870cd1a
      at <unknown source file>:<unknown line>
  17: git_branchless::commands::main::hfe0ad3abfd648f70
      at <unknown source file>:<unknown line>
  18: std::sys::backtrace::__rust_begin_short_backtrace::h3c8b3f6c88bba403
      at <unknown source file>:<unknown line>
  19: std::rt::lang_start::{{closure}}::h2b45849f85bd786f
      at <unknown source file>:<unknown line>
  20: std::rt::lang_start_internal::hbb268f70c879621d
      at <unknown source file>:<unknown line>
  21: main<unknown>
      at <unknown source file>:<unknown line>
  22: __libc_start_call_main<unknown>
      at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
  23: __libc_start_main_impl<unknown>
      at ./csu/../csu/libc-start.c:392
  24: _start<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.

Not sure how to reproduce it separately. But looking at the code

pub fn sorted_commit_set<'repo>(
it does seem buggy when there is a youger commit being the ancestor of an older commit (which I do have)

Expected behavior

No response

Actual behavior

No response

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

No response

Version of git

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions