Skip to content

Crash on non-absolute path in Windows #7643

Closed
@DutchGhost

Description

@DutchGhost

Problem

On windows, cargo crashes when "/" is used as a path for a dependency.

Backtrace
thread 'main' panicked at '`C:src\main.rs` is not absolute', src\tools\cargo\src/cargo\core\manifest.rs:286:9
stack backtrace:
   0:     0x7ff65be6e669 - git_odb_object_size
   1:     0x7ff65be9212b - git_odb_object_size
   2:     0x7ff65be65ac4 - git_odb_object_size
   3:     0x7ff65be72720 - git_odb_object_size
   4:     0x7ff65be7234a - git_odb_object_size
   5:     0x7ff65be72f78 - git_odb_object_size
   6:     0x7ff65be72ae4 - git_odb_object_size
   7:     0x7ff65be72a2f - git_odb_object_size
   8:     0x7ff65b989dfa - git_filter_source_repo
   9:     0x7ff65b98b474 - git_filter_source_repo
  10:     0x7ff65ba7a46e - git_index_checksum
  11:     0x7ff65b8f1c26 - git_filter_source_repo
  12:     0x7ff65b8e5be8 - git_filter_source_repo
  13:     0x7ff65b998808 - git_index_checksum
  14:     0x7ff65b952710 - git_filter_source_repo
  15:     0x7ff65b956c02 - git_filter_source_repo
  16:     0x7ff65b93031f - git_filter_source_repo
  17:     0x7ff65b9347df - git_filter_source_repo
  18:     0x7ff65ba58407 - git_index_checksum
  19:     0x7ff65bb05330 - git_index_checksum
  20:     0x7ff65bbde347 - git_filter_source_path
  21:     0x7ff65bb13884 - git_index_checksum
  22:     0x7ff65ba5ca2a - git_index_checksum
  23:     0x7ff65b8bd8bc - git_filter_source_repo
  24:     0x7ff65b8b573d - git_filter_source_repo
  25:     0x7ff65b8b2ac0 - git_filter_source_repo
  26:     0x7ff65b9a1511 - git_index_checksum
  27:     0x7ff65b99f74b - git_index_checksum
  28:     0x7ff65b99eca7 - git_index_checksum
  29:     0x7ff65b98eb92 - git_index_checksum
  30:     0x7ff65b98e640 - git_index_checksum
  31:     0x7ff65b73aafc - <unknown>
  32:     0x7ff65b74f82f - <unknown>
  33:     0x7ff65b798b57 - <unknown>
  34:     0x7ff65b784d66 - <unknown>
  35:     0x7ff65be72927 - git_odb_object_size
  36:     0x7ff65be80e62 - git_odb_object_size
  37:     0x7ff65be732b2 - git_odb_object_size
  38:     0x7ff65b79bcf7 - <unknown>
  39:     0x7ff65bfa94d4 - git_openssl_set_locking
  40:     0x7ffe00ff7974 - BaseThreadInitThunk
  41:     0x7ffe03c4a271 - RtlUserThreadStart

Steps

  1. cargo new crash
  2. cd crash
  3. open Cargo.toml, and paste in x = {path = "/"} in the [dependencies] section
  4. cargo build

Possible Solution(s)

On Windows, don't permit "/" as a path for a dependency?

Notes

Output of cargo version:
cargo 1.41.0-nightly (8280633 2019-11-11)
cargo 1.39.0 (1c6ec66 2019-09-30)

https://github.com/Evrey helped spark the idea of this bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions