mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Box clap commands to avoid windows debug clap stack overflow (#4768)
The changes in https://github.com/astral-sh/uv/pull/4708 caused an overflow in debug mode only of the 1MB default stack size in windows during clap. This means that even trivial wrong argument tests would fail without increasing the stack size. As remedy, we box the clap types.
This commit is contained in:
parent
1c6c8db1a2
commit
37f15367bb
2 changed files with 8 additions and 7 deletions
|
@ -55,13 +55,13 @@ fn extra_name_with_clap_error(arg: &str) -> Result<ExtraName> {
|
||||||
#[allow(clippy::struct_excessive_bools)]
|
#[allow(clippy::struct_excessive_bools)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
pub command: Commands,
|
pub command: Box<Commands>,
|
||||||
|
|
||||||
#[command(flatten)]
|
#[command(flatten)]
|
||||||
pub global_args: GlobalArgs,
|
pub global_args: Box<GlobalArgs>,
|
||||||
|
|
||||||
#[command(flatten)]
|
#[command(flatten)]
|
||||||
pub cache_args: CacheArgs,
|
pub cache_args: Box<CacheArgs>,
|
||||||
|
|
||||||
/// The path to a `uv.toml` file to use for configuration.
|
/// The path to a `uv.toml` file to use for configuration.
|
||||||
#[arg(global = true, long, env = "UV_CONFIG_FILE")]
|
#[arg(global = true, long, env = "UV_CONFIG_FILE")]
|
||||||
|
|
|
@ -148,7 +148,7 @@ async fn run() -> Result<ExitStatus> {
|
||||||
let globals = GlobalSettings::resolve(&cli.command, &cli.global_args, filesystem.as_ref());
|
let globals = GlobalSettings::resolve(&cli.command, &cli.global_args, filesystem.as_ref());
|
||||||
|
|
||||||
// Resolve the cache settings.
|
// Resolve the cache settings.
|
||||||
let cache_settings = CacheSettings::resolve(cli.cache_args, filesystem.as_ref());
|
let cache_settings = CacheSettings::resolve(*cli.cache_args, filesystem.as_ref());
|
||||||
|
|
||||||
// Configure the `tracing` crate, which controls internal logging.
|
// Configure the `tracing` crate, which controls internal logging.
|
||||||
#[cfg(feature = "tracing-durations-export")]
|
#[cfg(feature = "tracing-durations-export")]
|
||||||
|
@ -215,7 +215,7 @@ async fn run() -> Result<ExitStatus> {
|
||||||
// Configure the cache.
|
// Configure the cache.
|
||||||
let cache = Cache::from_settings(cache_settings.no_cache, cache_settings.cache_dir)?;
|
let cache = Cache::from_settings(cache_settings.no_cache, cache_settings.cache_dir)?;
|
||||||
|
|
||||||
match cli.command {
|
match *cli.command {
|
||||||
Commands::Pip(PipNamespace {
|
Commands::Pip(PipNamespace {
|
||||||
command: PipCommand::Compile(args),
|
command: PipCommand::Compile(args),
|
||||||
}) => {
|
}) => {
|
||||||
|
@ -945,8 +945,9 @@ async fn run() -> Result<ExitStatus> {
|
||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
let result = if let Ok(stack_size) = env::var("UV_STACK_SIZE") {
|
let result = if let Ok(stack_size) = env::var("UV_STACK_SIZE") {
|
||||||
// Artificially limit the stack size to test for stack overflows. Windows has a default stack size of 1MB,
|
// Artificially limit or increase the stack size to test without stack overflows in debug
|
||||||
// which is lower than the linux and mac default.
|
// mode. Windows has a default stack size of 1MB, which is lower than the linux and mac
|
||||||
|
// default.
|
||||||
// https://learn.microsoft.com/en-us/cpp/build/reference/stack-stack-allocations?view=msvc-170
|
// https://learn.microsoft.com/en-us/cpp/build/reference/stack-stack-allocations?view=msvc-170
|
||||||
let stack_size = stack_size.parse().expect("Invalid stack size");
|
let stack_size = stack_size.parse().expect("Invalid stack size");
|
||||||
let tokio_main = move || {
|
let tokio_main = move || {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue