dfinity / dfinity/sdk

'Cannot parse version' when try to debugging dfx executable

Open
#3,625 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
Rust
Stars
204
Forks
98
PR merge metrics
No merged PRs in 30d

Description

I tried the following:

  1. build
git clone https://github.com/dfinity/sdk.git 
cd sdk
cargo build 
  1. debug:
    in vscode luanch.json:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "canister_upgrader debug",
      "type": "lldb",
      "request": "launch",
      "program": "${workspaceFolder}/target/debug/dfx",
      // simulate: `dfx deploy backend --verbose`
      "args": ["deploy", "backend","--verbose"],
      // a folder gen by : `dfx new test_canister --type=rust`
      "cwd": "/home/btwl/code/ic/test_canister/",
      "stopOnEntry": true,
      "env": { "RUST_BACKTRACE": "1", "DFX_VERSION": "0.17.0", "CARGO_PKG_VERSION": "0.17.0"}
    }
  ]
}

I expected to see this happen:
set a breakpoint at src/dfx/src/main.rs and program pause at breakpoint.

Instead, this happened:

thread 'main' panicked at src/dfx/src/config/mod.rs:9:51:
Cannot parse version.: Error("unexpected character '+' after major version number")
stack backtrace:
   0: rust_begin_unwind
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
   2: core::result::unwrap_failed
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
   3: core::result::Result<T,E>::expect
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1034:23
   4: <dfx::config::VERSION as core::ops::deref::Deref>::deref::__static_ref_initialize
             at ./src/dfx/src/config/mod.rs:9:9
   5: core::ops::function::FnOnce::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
   6: lazy_static::lazy::Lazy<T>::get::{{closure}}
             at /home/btwl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lazy_static-1.4.0/src/inline_lazy.rs:31:29
   7: std::sync::once::Once::call_once::{{closure}}
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sync/once.rs:149:41
   8: std::sys_common::once::futex::Once::call
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/once/futex.rs:124:21
   9: std::sync::once::Once::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sync/once.rs:149:9
  10: lazy_static::lazy::Lazy<T>::get
             at /home/btwl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lazy_static-1.4.0/src/inline_lazy.rs:30:9
  11: <dfx::config::VERSION as core::ops::deref::Deref>::deref::__stability
             at /home/btwl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lazy_static-1.4.0/src/lib.rs:142:21
  12: <dfx::config::VERSION as core::ops::deref::Deref>::deref
             at /home/btwl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lazy_static-1.4.0/src/lib.rs:144:17
  13: dfx::config::dfx_version
             at ./src/dfx/src/config/mod.rs:20:5
  14: dfx::get_args_altered_for_extension_run
             at ./src/dfx/src/main.rs:166:36
  15: dfx::main
             at ./src/dfx/src/main.rs:185:16
  16: core::ops::function::FnOnce::call_once
             at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Meta

dfx --version: latest github pull. 2024-2-29 . should be 0.17.0

 0.17.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/dfx/src/config/mod.rs, where VERSION is parsed, and trace its use from dfx_version through src/dfx/src/main.rs. Reproduce with the provided cargo build and VS Code LLDB launch configuration, including the listed environment variables. Done means the debug launch reaches the breakpoint without the version-parsing panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.