From e0c64599cc60a8fc1ff3815bd93b9cf12e3a036a Mon Sep 17 00:00:00 2001 From: Harrison Booth <73434116+Harrison-Booth@users.noreply.github.com> Date: Wed, 28 Oct 2026 13:09:02 -0500 Subject: [PATCH] dc-upkeep-7: allow larger command-file media --- apps/deckcraft-cli/src/help.rs | 5 +++-- apps/deckcraft-cli/src/main.rs | 2 +- apps/deckcraft-cli/tests/it/cli.rs | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/deckcraft-cli/src/help.rs b/apps/deckcraft-cli/src/help.rs index 1d8cdce2..b77c0478 100644 --- a/apps/deckcraft-cli/src/help.rs +++ b/apps/deckcraft-cli/src/help.rs @@ -72,8 +72,9 @@ Each --cmd is one command: COMMAND is a command id, then `=`, then the command's JSON object. Quote it for the shell. A command that needs no parameters is just its id. --cmd-file FILE reads the same commands from a UTF-8 text file, one per line, avoiding shell quoting -and command-line length limits. Blank lines and full-line # comments are ignored, as is surrounding -whitespace. CRLF line endings and an optional UTF-8 BOM at the start of the file are accepted. +and command-line length limits. Each line can be up to 16 MiB, including commands with embedded +media data. Blank lines and full-line # comments are ignored, as is surrounding whitespace. CRLF +line endings and an optional UTF-8 BOM at the start of the file are accepted. Repeat --cmd-file or mix it with --cmd: commands execute in the order those options appear. File errors name the path; line-reading, JSON and command errors also name the line number. diff --git a/apps/deckcraft-cli/src/main.rs b/apps/deckcraft-cli/src/main.rs index be99ee07..2fb9fa8e 100644 --- a/apps/deckcraft-cli/src/main.rs +++ b/apps/deckcraft-cli/src/main.rs @@ -455,7 +455,7 @@ enum CommandSource { File(String), } -const MAX_COMMAND_FILE_LINE_BYTES: usize = 1024 * 1024; +const MAX_COMMAND_FILE_LINE_BYTES: usize = 16 * 1024 * 1024; fn read_command_file_line(reader: &mut impl std::io::BufRead, line: &mut Vec) -> std::io::Result { line.clear(); diff --git a/apps/deckcraft-cli/tests/it/cli.rs b/apps/deckcraft-cli/tests/it/cli.rs index fef870a8..a6ec0248 100644 --- a/apps/deckcraft-cli/tests/it/cli.rs +++ b/apps/deckcraft-cli/tests/it/cli.rs @@ -146,12 +146,12 @@ fn command_file_read_errors_name_the_path_and_utf8_line() { fn command_file_rejects_an_oversized_line_before_running_it() { let dir = command_file_dir("line-limit"); let file = dir.join("commands.txt"); - let command = format!("slide.new={{\"title\":\"{}\"}}", "x".repeat(1024 * 1024)); + let command = format!("slide.new={{\"title\":\"{}\"}}", "x".repeat(16 * 1024 * 1024)); std::fs::write(&file, format!("{command}\nslide.new\n")).unwrap(); let o = cli(&["run", "--print", "--cmd-file", &file.to_string_lossy()]); let err = stderr(&o); - assert!(err.contains(&format!("{}:1:", file.display())) && err.contains("command line exceeds 1048576 byte limit"), "{err}"); + assert!(err.contains(&format!("{}:1:", file.display())) && err.contains("command line exceeds 16777216 byte limit"), "{err}"); assert!(o.stdout.is_empty(), "the oversized command must not run"); std::fs::remove_dir_all(dir).unwrap(); }