Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Assertion fails when passing `C:` as command line argument

オープン 初心者向け
#367 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
rust

調査の方向性

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/edit のほかの issue

microsoft/edit の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。