Skip to content

Comments

fix: Add useful debug message when files are missing from config#15499

Merged
christopherco merged 1 commit intomicrosoft:3.0-devfrom
dmcilvaney:damcilva/fix_missing_imgconfig_Files
Jan 16, 2026
Merged

fix: Add useful debug message when files are missing from config#15499
christopherco merged 1 commit intomicrosoft:3.0-devfrom
dmcilvaney:damcilva/fix_missing_imgconfig_Files

Conversation

@dmcilvaney
Copy link
Contributor

@dmcilvaney dmcilvaney commented Jan 14, 2026

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

Improve error messages when image config files reference missing files (PackageLists, scripts, AdditionalFiles, etc.).

Previously, if a referenced file was missing, Make would fail with a confusing message about having no rule to build the validation flag. If the missing file was in a non-existent directory, realpath would also print unhelpful errors before the actual failure.

This was caused by Make's pattern rule matching behavior. The validation rules is $(STATUS_FLAGS_DIR)/validate-image-config%.flag:, which matches the variable validate-config = $(STATUS_FLAGS_DIR)/validate-image-config-$(config_name).flag

The rule had config_other_files = $(if $(CONFIG_FILE),$(call shell_real_build_only, $(SCRIPTS_DIR)/get_config_deps.sh $(CONFIG_FILE)),) as a dependency. If one of those calculated files was missing, then make would consider the pattern matched rule un-usable, and would try to find an alternate rule that did have all its dependencies. Unfortunately, we only have one pattern match rule, so we must ensure that all the dependencies we list are either real files, or valid make targets, so make won't skip it.

Change Log
  • Add early validation in imggen.mk to detect missing config dependencies and display a clear error message listing all missing files
  • Use realpath -m in get_config_deps.sh to handle paths where parent directories don't exist
  • Skip the missing file check for printvar-* targets so users can still debug
Does this affect the toolchain?

NO

Test Methodology

@dmcilvaney dmcilvaney requested a review from a team as a code owner January 14, 2026 00:42
@microsoft-github-policy-service microsoft-github-policy-service bot added Tools 3.0-dev PRs Destined for AzureLinux 3.0 labels Jan 14, 2026
# Define newline for use in error messages and output formatting
define newline


Copy link
Member

Choose a reason for hiding this comment

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

does this intentionally include 2 newlines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, make trims the last one off, so to get one newline, you need two.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves error handling when image configuration files reference missing dependencies. Previously, Make would fail with a confusing "no rule to make target" error. Now, users get a clear, actionable error message listing all missing files.

Changes:

  • Add a newline helper in utils.mk for formatting multi-line error messages
  • Implement early validation in imggen.mk to detect missing config dependencies before Make processes them
  • Modify get_config_deps.sh to use realpath -m so it can handle paths in non-existent directories

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
toolkit/scripts/utils.mk Adds newline variable definition for formatting error messages
toolkit/scripts/imggen.mk Adds validation logic to check for missing config files and display helpful error messages
toolkit/scripts/get_config_deps.sh Uses realpath -m flag to canonicalize paths even when parent directories don't exist

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# Validate that all config dependencies exist before Make tries to process them as prerequisites
# If we don't do this, Make will error out with a less-than-helpful message about having no rule to make
# the validation flag (since its a pattern match and if a dependency is missing, it can't match the pattern)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

Grammar error: 'its' should be "it's" (it is). The contraction is needed here since you're saying "it is a pattern match".

Suggested change
# the validation flag (since its a pattern match and if a dependency is missing, it can't match the pattern)
# the validation flag (since it's a pattern match and if a dependency is missing, it can't match the pattern)

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@christopherco christopherco left a comment

Choose a reason for hiding this comment

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

:shipit:

@christopherco christopherco merged commit 5027dba into microsoft:3.0-dev Jan 16, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 Tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants