os icon indicating copy to clipboard operation
os copied to clipboard

feat: add xfs patches to enable populating from directory

Open 89luca89 opened this issue 8 months ago • 1 comments

mkfs: add -P flag to populate a filesystem from a directory

89luca89 avatar Apr 23 '25 16:04 89luca89

🩹 Build Failed: Patch Application Failed

/bin/sh: can't open v10-0000-cover-letter.patch: no such file

Build Details

Category Details
Build System melange
Failure Point running step "patch"

Root Cause Analysis 🔍

The build is attempting to apply a patch file named 'v10-0000-cover-letter.patch' that doesn't exist in the expected location. This is likely a misconfiguration in the xfsprogs.yaml file where a patch is referenced but not correctly included in the build context or source directory.


🔍 Build failure fix suggestions

Found similar build failures that have been fixed in the past and analyzed them to suggest a fix:

Suggested Changes

File: xfsprogs.yaml

  • modification at line 29-31 (pipeline.uses:patch) Original:
  # Import downstream patches from https://lore.kernel.org/linux-xfs/[email protected]/
  # waiting for upstream to merge.
  - uses: patch
    with:
      patches: v10-0000-cover-letter.patch v10-0001-proto-add-ability-to-populate-a-filesystem-from-.patch

Replacement:

  # Import downstream patches from https://lore.kernel.org/linux-xfs/[email protected]/
  # waiting for upstream to merge.
  - uses: fetch
    with:
      uri: https://lore.kernel.org/linux-xfs/[email protected]/raw
      expected-filename: patches.mbox
  
  - runs: |
      mkdir -p patches
      cd patches
      cat ../patches.mbox | formail -ds sh -c 'cat > $FILENO.patch'
      
  - uses: patch
    with:
      patches: patches/1.patch
Click to expand fix analysis

Analysis

The build failure occurs in the patch step of the melange build system. The error message indicates that a patch file named "v10-0000-cover-letter.patch" cannot be found. The pipeline is attempting to apply two patches: "v10-0000-cover-letter.patch" and "v10-0001-proto-add-ability-to-populate-a-filesystem-from-.patch". Both patches are mentioned in the "uses: patch" step, but they are not included in the build context, not fetched from anywhere, and not generated during the build process.

Click to expand fix explanation

Explanation

The build is failing because it's trying to apply patch files that don't exist in the build context. The error message explicitly states "can't open v10-0000-cover-letter.patch: no such file".

The suggested fix addresses this issue in a few ways:

  1. We fetch the patches from the URL mentioned in the comments (https://lore.kernel.org/linux-xfs/[email protected]/raw) which will download the complete mbox file containing all the patches.
  2. We then use the 'formail' utility (which should be available in the build environment via busybox) to split the mbox file into individual patch files.
  3. Finally, we update the patch step to apply the correct patch file.

This approach is more reliable than hardcoding patch filenames because it fetches the patches directly from the source and processes them appropriately. The YAML comment already mentions where the patches come from, so we're just implementing the proper way to fetch and apply them.

Note that the specific filename used (patches/1.patch) assumes that the patch containing the actual code changes will be the first substantive patch in the mbox file after the cover letter. If the mbox structure is different, this might need adjustment.

Click to expand alternative approaches

Alternative Approaches

  • Manually download the patch files and add them to the repository, then reference them directly in the YAML file
  • Remove the patching step entirely if the patches are not essential for the build to succeed
  • Use a different URI to fetch individual patch files directly instead of extracting them from an mbox file
  • Modify the fetch step to download each patch file individually with multiple fetch steps

Was this comment helpful? Please use 👍 or 👎 reactions on this comment.

octo-sts[bot] avatar May 28 '25 10:05 octo-sts[bot]