Skip to content
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

Crash on non-absolute path in Windows #7643

Closed
DutchGhost opened this issue Dec 1, 2019 · 3 comments
Closed

Crash on non-absolute path in Windows #7643

DutchGhost opened this issue Dec 1, 2019 · 3 comments
Labels
C-bug Category: bug O-windows OS: Windows

Comments

@DutchGhost
Copy link

DutchGhost commented Dec 1, 2019

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

@DutchGhost DutchGhost added the C-bug Category: bug label Dec 1, 2019
@DutchGhost DutchGhost changed the title Crash on non-absolute path Crash on non-absolute path in Windows Dec 1, 2019
@retep998
Copy link
Member

retep998 commented Dec 2, 2019

Technically / is a valid path on windows, it just doesn't mean what many people think it means.

@ehuss ehuss added the O-windows OS: Windows label Dec 3, 2019
@Thomasdezeeuw
Copy link

I've hit this as well, is the problem as simple as changing C:src\main.rs to C:\src\main.rs (a \ after C:)? If someone could point me to the related code I could give it a try.

@eminence
Copy link
Contributor

Triage: As of rust 1.47, there is no crash. The error message you see now is the following:

error: failed to get `x` as a dependency of package `crash v0.1.0 (C:\Users\achin\tmp\27\crash)`

Caused by:
  failed to load source for dependency `x`

Caused by:
  Unable to update C:\

Caused by:
  failed to read `C:\Cargo.toml`

Caused by:
  The system cannot find the file specified. (os error 2)

@Eh2406 Eh2406 closed this as completed Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug O-windows OS: Windows
Projects
None yet
Development

No branches or pull requests

6 participants