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

Deno 1.34.3 panics when run with --v8-flags and no filename #19627

Closed
tmcw opened this issue Jun 27, 2023 · 0 comments · Fixed by #20145
Closed

Deno 1.34.3 panics when run with --v8-flags and no filename #19627

tmcw opened this issue Jun 27, 2023 · 0 comments · Fixed by #20145
Labels
bug Something isn't working correctly

Comments

@tmcw
Copy link

tmcw commented Jun 27, 2023

deno run --v8-flags="--max-old-space-size=8192"

This produces the crash:

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos aarch64
Version: 1.34.3
Args: ["deno", "run", "--v8-flags=--max-old-space-size=8192"]

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', cli/args/flags.rs:2908:68
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Looks like this line is the culprit:

let mut script_arg = matches.remove_many::<String>("script_arg").unwrap();

@dsherret dsherret added the bug Something isn't working correctly label Jun 28, 2023
crowlKats pushed a commit that referenced this issue Aug 13, 2023
…ags` is present in `deno run` (#20145)

Fix #20022, fix #19627 (duplicate)

#17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0
(intentionally) broke a behavior that deno was relying on to make `deno
run --v8-flags=--help` work without specifying a file, see
clap-rs/clap#3793. The workaround was to make the script argument
required _unless_ `--v8-flags` is present. This broke the expectation
that all successfully parsed `run` commands have the script argument
set, leading to the panic on
`matches.remove_many::<String>("script_arg").unwrap()`.

Clap, as far as I was able to find out, does not currently offer a neat
solution to this problem. This PR adds logic to create and return a
custom clap error when a parsed run command does not have the script
argument.

I added an appropriate test.
littledivy pushed a commit to littledivy/deno that referenced this issue Aug 21, 2023
…ags` is present in `deno run` (denoland#20145)

Fix denoland#20022, fix denoland#19627 (duplicate)

denoland#17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0
(intentionally) broke a behavior that deno was relying on to make `deno
run --v8-flags=--help` work without specifying a file, see
clap-rs/clap#3793. The workaround was to make the script argument
required _unless_ `--v8-flags` is present. This broke the expectation
that all successfully parsed `run` commands have the script argument
set, leading to the panic on
`matches.remove_many::<String>("script_arg").unwrap()`.

Clap, as far as I was able to find out, does not currently offer a neat
solution to this problem. This PR adds logic to create and return a
custom clap error when a parsed run command does not have the script
argument.

I added an appropriate test.
littledivy pushed a commit that referenced this issue Aug 21, 2023
…ags` is present in `deno run` (#20145)

Fix #20022, fix #19627 (duplicate)

#17333 upgraded clap from version 3.1 to version 4. clap version 3.2.0
(intentionally) broke a behavior that deno was relying on to make `deno
run --v8-flags=--help` work without specifying a file, see
clap-rs/clap#3793. The workaround was to make the script argument
required _unless_ `--v8-flags` is present. This broke the expectation
that all successfully parsed `run` commands have the script argument
set, leading to the panic on
`matches.remove_many::<String>("script_arg").unwrap()`.

Clap, as far as I was able to find out, does not currently offer a neat
solution to this problem. This PR adds logic to create and return a
custom clap error when a parsed run command does not have the script
argument.

I added an appropriate test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
2 participants