Assertion fails when passing `C:` as command line argument
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 65/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- rust
- 領域
- cli, operating-systems
調査の方向性
src/path.rs:12 の失敗しているアサーションから始め、src/bin/edit/main.rs が handle_args 周辺で C: 引数をどのように処理しているかを追跡してください。Windows で cargo run -- C: を実行して問題を再現し、その後、コマンドがパニックせずに無題のバッファーで正常に開くことを確認してください。
索引モデルが issue の本文から書いたものです。
説明
Repro
Run the following command in this repository:
cargo run -- C:
Expected result
Edit opens successfully with an untitled buffer.
Actual result
Crashes with the following assertion error:
thread 'main' panicked at src\path.rs:12:5:
assertion failed: path.is_absolute()
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/2805e1dc4c18ed4c84d161502c48da870c56f68a/library\std\src\panicking.rs:697
1: core::panicking::panic_fmt
at /rustc/2805e1dc4c18ed4c84d161502c48da870c56f68a/library\core\src\panicking.rs:75
2: core::panicking::panic
at /rustc/2805e1dc4c18ed4c84d161502c48da870c56f68a/library\core\src\panicking.rs:145
3: edit::path::normalize
at .\src\path.rs:12
4: edit::handle_args
at .\src\bin\edit\main.rs:253
5: edit::run
at .\src\bin\edit\main.rs:74
6: edit::main
at .\src\bin\edit\main.rs:56
7: core::ops::function::FnOnce::call_once<std::process::ExitCode (*)(),tuple$<> >
at /rustc/2805e1dc4c18ed4c84d161502c48da870c56f68a\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Explanation
On Windows a drive letter path like C: is special. It is a relative path and it means the current working directory of the drive. If my understanding is correct, on Windows each drive has its current working directory.
This means
Path::new("C:").is_absolute()
returns false but
Path::new("C:\\foo").join("C:")
returns C:. This behavior causes the crash.
- 主要言語
- Rust
- スター
- 14.6k
- フォーク
- 735
- 平均マージ
- 8時間 40分
- マージ済み PR(30日)
- 4
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/edit のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug core
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW オープンfuzz
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ClickHouse/ClickHouse#122114 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
linebender/vello_svg#90 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100