Skip to content

artifact-rootfs: surface git-log failure when computing configng hash#9849

Open
igorpecovnik wants to merge 1 commit into
mainfrom
rootfs-cache-invalidate-on-configng-change
Open

artifact-rootfs: surface git-log failure when computing configng hash#9849
igorpecovnik wants to merge 1 commit into
mainfrom
rootfs-cache-invalidate-on-configng-change

Conversation

@igorpecovnik
Copy link
Copy Markdown
Member

@igorpecovnik igorpecovnik commented May 17, 2026

Scope kept exactly as before — path filter on `tools/modules/desktops/` and `BUILD_DESKTOP=yes` gate both stay. Only behaviour change is visibility on git failure.

Before

```bash
configng_desktops_hash="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>/dev/null || echo "unknown")"
```

Failure modes (torn checkout, broken HEAD, permissions, stale clone) silently swallowed; operator gets the degraded cache key with no log line explaining why.

After

```bash
git_out="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>&1)"
git_rc=$?
if (( git_rc == 0 )); then
configng_desktops_hash="${git_out}"
else
display_alert "configng_desktops hash: git log failed (rc=${git_rc}) in ${configng_dir}" "${git_out}" "warn"
configng_desktops_hash="unknown"
fi
```

Falls through to the same "unknown" sentinel, so the build still completes — this is a best-effort caching input, not a build-blocker, and the downstream check in `create-cache.sh` already skips the fingerprint fold on "unknown" / "undetermined". An earlier rev of this PR broadened the scope to all builds + the entire repo; reverted after discussion — CLI builds don't invoke armbian-config at build time so configng content outside the desktop subtree doesn't reach the rootfs from a build-time path.

Also picked up a comment touch-up in `create-cache.sh` documenting the BUILD_DESKTOP scoping for future readers.

Test plan

  • Healthy desktop build — cache fingerprint matches old behaviour, no warn line
  • `rm -rf cache/sources/armbian-configng/.git/HEAD` (or otherwise break the clone); rebuild — see the new `configng_desktops hash: git log failed (rc=N) in …` warn, build completes with cache_type missing the fingerprint suffix

Summary by CodeRabbit

  • Bug Fixes

    • Improved error reporting during build operations with visible warnings when certain checks fail, replacing silent fallback behavior.
  • Documentation

    • Clarified build configuration scoping notes to better explain how different image types utilize build tools and dependencies.

Review Change Stack

@igorpecovnik igorpecovnik requested a review from a team as a code owner May 17, 2026 22:15
@igorpecovnik igorpecovnik requested review from ArkadiuszRaj and martinayotte and removed request for a team May 17, 2026 22:15
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

📝 Walkthrough

Walkthrough

The pull request improves error handling and scope documentation for desktop-specific cache invalidation. It refines the CONFIGNG_DESKTOPS_HASH computation to emit warnings on git failures instead of silently suppressing errors, and explicitly clarifies in comments that this fingerprinting applies only to desktop builds.

Changes

Desktop hash error handling and scope clarity

Layer / File(s) Summary
Desktop hash computation with explicit error warnings
lib/functions/artifacts/artifact-rootfs.sh, lib/functions/rootfs/create-cache.sh
CONFIGNG_DESKTOPS_HASH computation replaces silent stderr suppression with captured output and display_alert warnings on git log failure. Comments updated to explicitly scope this cache invalidation to desktop builds and clarify that CLI images remain unaffected.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A desktop hash now speaks its mind,
When git goes wrong, no silence blind—
The warnings flow, the scope is clear,
Cache busts for desktops drawing near! 🎨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes a specific technical change (surfacing git-log failure when computing configng hash) that is directly reflected in the raw summary, which documents changes to error-handling logic in artifact_rootfs_config_dump.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rootfs-cache-invalidate-on-configng-change

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added 05 Milestone: Second quarter release size/medium PR with more then 50 and less then 250 lines Needs review Seeking for review Framework Framework components labels May 17, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/functions/artifacts/artifact-rootfs.sh`:
- Around line 30-32: The code masks failures from "git -C \"${configng_dir}\"
log -1 --format=%H" by appending "|| echo \"unknown\"", which hides real errors;
change the logic around configng_hash so that failures from git log are not
suppressed—either remove the "|| echo \"unknown\"" so the command fails fast
under set -o errexit, or explicitly capture the git output and check the exit
status and call error/exit if git returns non-zero. Update the block that sets
configng_hash (referencing configng_dir and configng_hash) to propagate git
errors instead of silencing them, and add a clear error log if you choose the
explicit-check approach.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9678335b-6eed-4b0a-a752-ebf649bdb73b

📥 Commits

Reviewing files that changed from the base of the PR and between 502e9d4 and fa3af47.

📒 Files selected for processing (3)
  • lib/functions/artifacts/artifact-rootfs.sh
  • lib/functions/configuration/config-desktop.sh
  • lib/functions/rootfs/create-cache.sh

Comment on lines 30 to 32
if [[ -d "${configng_dir}/.git" ]]; then
configng_hash="$(git -C "${configng_dir}" log -1 --format=%H 2>/dev/null || echo "unknown")"
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the file and surrounding context
head -50 lib/functions/artifacts/artifact-rootfs.sh | cat -n

Repository: armbian/build

Length of output: 2681


🏁 Script executed:

# Check if the file exists and see full context around lines 30-32
wc -l lib/functions/artifacts/artifact-rootfs.sh

Repository: armbian/build

Length of output: 104


🏁 Script executed:

# Read the specific section with more context
sed -n '1,50p' lib/functions/artifacts/artifact-rootfs.sh | cat -n

Repository: armbian/build

Length of output: 2681


🏁 Script executed:

# Search for how configng_hash is used in the file
rg "configng_hash" lib/functions/artifacts/artifact-rootfs.sh -A 3 -B 1

Repository: armbian/build

Length of output: 506


🏁 Script executed:

# Check if the script uses set -e
rg "set -e" lib/functions/artifacts/artifact-rootfs.sh

Repository: armbian/build

Length of output: 39


🏁 Script executed:

# Check if exit_with_error function exists
rg "exit_with_error" . --type sh | head -20

Repository: armbian/build

Length of output: 2817


🏁 Script executed:

# Search for where artifact-rootfs.sh is sourced
rg "artifact-rootfs" . --type sh

Repository: armbian/build

Length of output: 615


🏁 Script executed:

# Check main build script or entrypoint for set -e
rg "set -e" . --type sh | head -20

Repository: armbian/build

Length of output: 2073


🏁 Script executed:

# Search for how CONFIGNG_HASH is used in cache calculations
rg "CONFIGNG_HASH" . --type sh -B 2 -A 2

Repository: armbian/build

Length of output: 2370


🏁 Script executed:

# Check git log failure scenarios
rg "git.*log" lib/functions/artifacts/ --type sh -B 2 -A 2

Repository: armbian/build

Length of output: 987


🏁 Script executed:

# Check how CONFIGNG_HASH is used in the cache filename/calculation
rg -A 10 "_configng_fp=" lib/functions/rootfs/create-cache.sh

Repository: armbian/build

Length of output: 508


🏁 Script executed:

# Check if there's any special handling for "unknown" values
rg "unknown" lib/functions/rootfs/create-cache.sh

Repository: armbian/build

Length of output: 103


🏁 Script executed:

# Understand the full cache ID calculation
rg "cache.*id\|rootfs_cache_id" lib/functions/rootfs/create-cache.sh -B 2 -A 2 | head -50

Repository: armbian/build

Length of output: 39


🏁 Script executed:

# Find exit_with_error definition
rg "^function exit_with_error|^exit_with_error\(\)" lib/ -A 5

Repository: armbian/build

Length of output: 461


🏁 Script executed:

# Check if exit_with_error is sourced before artifact-rootfs.sh
head -100 lib/library-functions.sh | grep -E "exit_with_error|artifact-rootfs"

Repository: armbian/build

Length of output: 226


Fail fast when git log fails in an existing armbian-configng clone.

Line 31 masks git log failure with || echo "unknown". This violates fail-fast expectations given set -o errexit is enabled in the sourcing context (lib/library-functions.sh). If git log fails—due to repo corruption, permission issues, or other problems—the build continues silently instead of surfacing the error. While the cache layer explicitly excludes "unknown" from the fingerprint calculation, masking the failure hides a genuine error condition that should halt the build.

Suggested fix
 if [[ -d "${configng_dir}/.git" ]]; then
-		configng_hash="$(git -C "${configng_dir}" log -1 --format=%H 2>/dev/null || echo "unknown")"
+		configng_hash="$(git -C "${configng_dir}" log -1 --format=%H 2>/dev/null)" \
+			|| exit_with_error "Failed to resolve CONFIGNG_HASH from ${configng_dir}"
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [[ -d "${configng_dir}/.git" ]]; then
configng_hash="$(git -C "${configng_dir}" log -1 --format=%H 2>/dev/null || echo "unknown")"
fi
if [[ -d "${configng_dir}/.git" ]]; then
configng_hash="$(git -C "${configng_dir}" log -1 --format=%H 2>/dev/null)" \
|| exit_with_error "Failed to resolve CONFIGNG_HASH from ${configng_dir}"
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/functions/artifacts/artifact-rootfs.sh` around lines 30 - 32, The code
masks failures from "git -C \"${configng_dir}\" log -1 --format=%H" by appending
"|| echo \"unknown\"", which hides real errors; change the logic around
configng_hash so that failures from git log are not suppressed—either remove the
"|| echo \"unknown\"" so the command fails fast under set -o errexit, or
explicitly capture the git output and check the exit status and call error/exit
if git returns non-zero. Update the block that sets configng_hash (referencing
configng_dir and configng_hash) to propagate git errors instead of silencing
them, and add a clear error log if you choose the explicit-check approach.

Original code masked git failures with `|| echo "unknown"` - the
build silently fell through to a degraded cache key without telling
the operator anything. A torn cache/sources/armbian-configng clone,
broken HEAD, or permissions glitch was indistinguishable from a
healthy "couldn't compute" state.

Capture stdout+stderr from git log, branch on exit status, and
display_alert the git error text when rc != 0. Still falls through
to "unknown" so the build completes - this is a best-effort
caching knob, not a build-blocker, and the downstream check in
create-cache.sh already skips the fingerprint fold on "unknown".

Scope kept exactly as before: BUILD_DESKTOP=yes only, path-filtered
to tools/modules/desktops/. CLI builds don't invoke armbian-config
at build time and configng content outside the desktop subtree
doesn't reach the rootfs from a build-time path, so broadening the
filter would only churn cache for no benefit. Comment touch-up in
create-cache.sh documents that scoping for future readers.
@igorpecovnik igorpecovnik force-pushed the rootfs-cache-invalidate-on-configng-change branch from a3bc971 to 019c0f4 Compare May 18, 2026 03:47
@github-actions github-actions Bot added size/small PR with less then 50 lines and removed size/medium PR with more then 50 and less then 250 lines labels May 18, 2026
@igorpecovnik igorpecovnik changed the title rootfs: invalidate cache on every configng change, CLI too artifact-rootfs: surface git-log failure when computing configng hash May 18, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/functions/artifacts/artifact-rootfs.sh`:
- Line 27: The variable name still uses
CONFIGNG_DESKTOPS_HASH/configng_desktops_hash but should be renamed to
CONFIGNG_HASH/configng_hash everywhere; update the declaration (declare
configng_hash="undetermined"), all subsequent references and assignments (e.g.,
places currently referencing configng_desktops_hash or CONFIGNG_DESKTOPS_HASH),
and any export or string interpolation to use CONFIGNG_HASH/configng_hash so the
hash applies to all build types rather than only "desktops".
- Around line 26-50: The BUILD_DESKTOP conditional is still preventing configng
cache-busting for non-desktop builds; remove the surrounding if [[
"${BUILD_DESKTOP}" == "yes" ]] check so the configng_desktops_hash logic always
runs: always declare and compute configng_desktops_hash (using configng_dir and
the git -C ... log command with git_out/git_rc), call display_alert on failure,
set artifact_input_variables[CONFIGNG_DESKTOPS_HASH] to the resulting hash (or
"unknown"/"undetermined" as the existing logic does), and ensure no
BUILD_DESKTOP gating remains around those statements.
- Line 40: The git invocation in artifact-rootfs.sh still uses a path filter
("tools/modules/desktops/") so the commit hash in git_out only reflects changes
to that path; remove the path filter so git computes the last commit for the
whole repo by changing the git command that sets git_out (the git -C
"${configng_dir}" log -1 --format=%H ... call) to not include the path argument,
leaving only git -C "${configng_dir}" log -1 --format=%H 2>&1; keep the same
variable (git_out) and error handling around that command.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 313a13e2-e0ea-46a5-8eda-0eaec64cfa52

📥 Commits

Reviewing files that changed from the base of the PR and between a3bc971 and 019c0f4.

📒 Files selected for processing (2)
  • lib/functions/artifacts/artifact-rootfs.sh
  • lib/functions/rootfs/create-cache.sh
✅ Files skipped from review due to trivial changes (1)
  • lib/functions/rootfs/create-cache.sh

Comment on lines 26 to 50
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
declare configng_desktops_hash="undetermined"
local configng_dir="${SRC}/cache/sources/armbian-configng"
if [[ -d "${configng_dir}/.git" ]]; then
configng_desktops_hash="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>/dev/null || echo "unknown")"
# Capture stdout + stderr, then branch on exit status. This is
# a best-effort knob for cache-invalidation, not a build
# blocker - if git can't read this clone (torn checkout,
# stale files, broken HEAD, permissions), we warn and fall
# through to "unknown" rather than aborting an hour-long
# build. The downstream check in create-cache.sh skips the
# fingerprint fold on "unknown" / "undetermined" — the
# build still produces a valid image, it just doesn't get
# the configng-aware cache bust.
declare git_out git_rc
git_out="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>&1)"
git_rc=$?
if (( git_rc == 0 )); then
configng_desktops_hash="${git_out}"
else
display_alert "configng_desktops hash: git log failed (rc=${git_rc}) in ${configng_dir}" "${git_out}" "warn"
configng_desktops_hash="unknown"
fi
fi
artifact_input_variables[CONFIGNG_DESKTOPS_HASH]="${configng_desktops_hash}"
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

PR objectives claim BUILD_DESKTOP gate should be removed, but it remains.

The PR objectives state the fix should "remove the BUILD_DESKTOP gate" so "any commit in cache/sources/armbian-configng now bumps the rootfs cache key for all build flavours" (emphasis added). However, lines 26-50 still wrap the entire hash computation in if [[ "${BUILD_DESKTOP}" == "yes" ]], meaning CLI builds continue to skip configng cache invalidation. This contradicts the stated bug fix and leaves the original issue unresolved.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/functions/artifacts/artifact-rootfs.sh` around lines 26 - 50, The
BUILD_DESKTOP conditional is still preventing configng cache-busting for
non-desktop builds; remove the surrounding if [[ "${BUILD_DESKTOP}" == "yes" ]]
check so the configng_desktops_hash logic always runs: always declare and
compute configng_desktops_hash (using configng_dir and the git -C ... log
command with git_out/git_rc), call display_alert on failure, set
artifact_input_variables[CONFIGNG_DESKTOPS_HASH] to the resulting hash (or
"unknown"/"undetermined" as the existing logic does), and ensure no
BUILD_DESKTOP gating remains around those statements.

# (`module_desktops install mode=build`); for CLI builds the .deb
# is just installed and its contents don't affect the rootfs.
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
declare configng_desktops_hash="undetermined"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Variable still named CONFIGNG_DESKTOPS_HASH instead of CONFIGNG_HASH.

The PR objectives state the fix should "rename CONFIGNG_DESKTOPS_HASH → CONFIGNG_HASH", but the code at lines 27, 43, 46, 49, and 81 continues to use CONFIGNG_DESKTOPS_HASH and configng_desktops_hash. This name implies desktop-only scope, which contradicts the objective of applying the hash to all build types.

Also applies to: 43-43, 46-46, 49-49, 81-81

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/functions/artifacts/artifact-rootfs.sh` at line 27, The variable name
still uses CONFIGNG_DESKTOPS_HASH/configng_desktops_hash but should be renamed
to CONFIGNG_HASH/configng_hash everywhere; update the declaration (declare
configng_hash="undetermined"), all subsequent references and assignments (e.g.,
places currently referencing configng_desktops_hash or CONFIGNG_DESKTOPS_HASH),
and any export or string interpolation to use CONFIGNG_HASH/configng_hash so the
hash applies to all build types rather than only "desktops".

# build still produces a valid image, it just doesn't get
# the configng-aware cache bust.
declare git_out git_rc
git_out="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>&1)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Path filter -- tools/modules/desktops/ still present in git log.

The PR objectives state the fix should "remove the path filter from git log -1" so that "any commit" in armbian-configng invalidates the cache, but line 40 still restricts the hash to commits touching tools/modules/desktops/. This means commits to CLI helpers, system modules, postinst scripts, or the parser will not invalidate the cache—the exact bug the PR claims to fix.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/functions/artifacts/artifact-rootfs.sh` at line 40, The git invocation in
artifact-rootfs.sh still uses a path filter ("tools/modules/desktops/") so the
commit hash in git_out only reflects changes to that path; remove the path
filter so git computes the last commit for the whole repo by changing the git
command that sets git_out (the git -C "${configng_dir}" log -1 --format=%H ...
call) to not include the path argument, leaving only git -C "${configng_dir}"
log -1 --format=%H 2>&1; keep the same variable (git_out) and error handling
around that command.

@iav
Copy link
Copy Markdown
Contributor

iav commented May 22, 2026

Reviewed the current revision. Two issues with the new explicit-capture block; the intent of the PR is right but the implementation regresses the failure path it is meant to fix.

1. set -e aborts before the error handler can run

git_out="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>&1)"
git_rc=$?
if (( git_rc == 0 )); then
    ...
else
    display_alert "... git log failed (rc=${git_rc}) ..." "${git_out}" "warn"
    configng_desktops_hash="unknown"
fi

compile.sh enables set -e / set -o errexit, and under bash 5.x a plain var=$(failing_cmd) triggers errexit on the assignment itself — the next line (git_rc=$?) is never reached, and neither is the else branch with the warn and the "unknown" fallback.

Reproducer on bash 5.2:

$ bash -c 'set -e; x=$(false); rc=$?; echo got=$rc'
(no output, exit 1)

The previous code held together precisely because of || echo "unknown" inside the substitution: the command substitution as a whole returned 0, errexit stayed quiet, and the build continued with the "unknown" sentinel that create-cache.sh already special-cases. With that guard removed, the exact scenarios listed in the PR description (torn checkout, broken HEAD, permission errors on .git/objects) now hard-abort the build with an opaque Error 1 occurred instead of degrading the cache key — strictly worse than before.

Suggested fixes (any one):

# Minimal — restore the original guard, drop the merge of stderr:
configng_desktops_hash="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>/dev/null || echo "unknown")"
# Explicit capture compatible with errexit:
if git_out="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>/dev/null)"; then
    configng_desktops_hash="${git_out}"
else
    git_rc=$?
    display_alert "configng_desktops hash: git log failed (rc=${git_rc}) in ${configng_dir}" "see build log for details" "warn"
    configng_desktops_hash="unknown"
fi

2. 2>&1 pollutes the hash on the success path

git log -1 --format=%H can succeed (rc=0) and still emit lines to stderr — hint: / advice.* notices, partial-clone hints, fsmonitor messages, locale warnings. With 2>&1 those lines are concatenated with the SHA in git_out, and configng_desktops_hash is no longer a pure hex SHA.

Downstream, lib/functions/rootfs/create-cache.sh:73 does:

cache_type="${cache_type}-${_configng_fp:0:8}"

— the first eight bytes are then taken from whatever the warning text starts with, not from the SHA. Two different repo states can collide on the same cache tarball, or non-printable / unexpected characters end up in the filename.

The previous code discarded stderr (2>/dev/null), which avoided this. Either restore that, or keep stderr on a separate fd and only feed it to display_alert on the failure path:

git_err="${WORKDIR:-${SRC}/.tmp}/configng-git.err"
if git_out="$(git -C "${configng_dir}" log -1 --format=%H -- tools/modules/desktops/ 2>"${git_err}")"; then
    configng_desktops_hash="${git_out}"
else
    git_rc=$?
    display_alert "configng_desktops hash: git log failed (rc=${git_rc}) in ${configng_dir}" "$(< "${git_err}")" "warn"
    configng_desktops_hash="unknown"
fi
rm -f "${git_err}"

Note on the comment touch-up

The comment additions in artifact-rootfs.sh and create-cache.sh accurately describe the existing scope decisions (desktop-only gate, desktop-only subtree) and are useful as-is — no change requested there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Framework Framework components Needs review Seeking for review size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

2 participants