nodejs / nodejs/node-gyp

Inconsistent Order of build_files in WriteAutoRegenerationRule Causes CI Failures

Open
#3,061 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

Hey 👋
When running node-gyp, the Makefile generation process produces different outputs on subsequent runs due to the unordered nature of the build_files set in the WriteAutoRegenerationRule function. This inconsistency occurs because sets in Python do not maintain order, leading to varying order of dependencies in the generated Makefile.

This issue causes problems in CI pipelines that compare file hashes, as the differing order results in false positives for changes. To ensure a stable and consistent build process, the order of build_files should be explicitly sorted before being used in the Makefile generation.

https://github.com/nodejs/node-gyp/blob/e6f4ede10cca28e9edeaa85d7830914c5d1499c7/gyp/pylib/gyp/generator/make.py#L2386

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in gyp/pylib/gyp/generator/make.py at WriteAutoRegenerationRule around the referenced line, and inspect how build_files is used when generating the Makefile. Confirm that repeated generation produces a stable dependency order and verify the relevant Makefile output or existing generator tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.