From a408e0cbdf9cf6a59d9e86d33aea80515681b229 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Fri, 3 Jan 2025 11:44:00 +0100 Subject: [PATCH] cli-docker: avoid `argument list too long` errors when too many git changes present; fixes #6993 --- lib/functions/cli/cli-docker.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/functions/cli/cli-docker.sh b/lib/functions/cli/cli-docker.sh index f4e8be0e7d..2d6e43789b 100644 --- a/lib/functions/cli/cli-docker.sh +++ b/lib/functions/cli/cli-docker.sh @@ -34,6 +34,12 @@ function cli_docker_run() { # It's gonna be picked up by export_ansi_logs() and included in the final log, if it exists. declare -g GIT_INFO_ANSI GIT_INFO_ANSI="$(prepare_ansi_git_info_log_header)" + # GIT_INFO_ANSI can grow to be quite large if there are many changed files. + # If it's too big, it will cause "argument list too long" errors when launching docker. + # Limit it to 1024 characters, otherwise replace it with a simple message. + if [[ ${#GIT_INFO_ANSI} -gt 1024 ]]; then + GIT_INFO_ANSI="Armbian: too many git changes to list." + fi # Same stuff for BUILD_REPOSITORY_URL and BUILD_REPOSITORY_COMMIT. if [[ -d "${SRC}/.git" && "${CONFIG_DEFS_ONLY}" != "yes" ]]; then # don't waste time if only gathering config defs