Skip to content

Conversation

@tulilirockz
Copy link
Member

This should make it slightly easier to test stuff. It just builds an image that you can mount on /var/lib/extensions if you want to

Signed-off-by: Tulip Blossom <tulilirockz@outlook.com>
@dosubot dosubot bot added the size:M label Jan 10, 2026
@dosubot
Copy link

dosubot bot commented Jan 10, 2026

Related Documentation

Checked 8 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new overlay command in the Justfile to facilitate system extension testing by building an EROFS image. This is a great addition for testing purposes. My review focuses on improving the robustness and correctness of the new bash script. I've pointed out two high-severity issues: the script should be configured to exit on any error to prevent generating faulty images, and a directory move operation is flawed, potentially leading to an incorrect filesystem structure in the generated image. Addressing these points will make the new command more reliable.


overlay $BLUEFIN_MERGE="1":
#!/usr/bin/env bash
ROOTFS_DIR="$(mktemp -d --tmpdir="${ROOTFS_BASE:-/tmp}")"

Choose a reason for hiding this comment

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

high

The script should be configured to exit immediately if any command fails. Without this, an error in one of the steps (e.g., crane export failing) would be ignored, and the script would continue executing, potentially resulting in a corrupt or incomplete image. Adding set -euo pipefail is a best practice for writing robust shell scripts.

  • set -e: Exits the script if any command fails.
  • set -u: Treats unset variables as an error.
  • set -o pipefail: Ensures that a pipeline's exit code is the exit code of the last command to exit with a non-zero status, which is crucial for the crane | tar command on line 42.
    set -euo pipefail
    ROOTFS_DIR="$(mktemp -d --tmpdir="${ROOTFS_BASE:-/tmp}")"

Comment on lines +53 to +55
if [ -d "${ROOTFS_DIR}/etc" ] ; then
mv --no-clobber "${ROOTFS_DIR}/etc" "${ROOTFS_DIR}/usr/etc"
fi

Choose a reason for hiding this comment

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

high

The mv command used here is incorrect if ${ROOTFS_DIR}/usr/etc already exists. It would move the etc directory inside usr/etc, creating ${ROOTFS_DIR}/usr/etc/etc, which is not the intended behavior.

To correctly merge the contents of ${ROOTFS_DIR}/etc into ${ROOTFS_DIR}/usr/etc, it's better to use cp to copy the contents and then rm to delete the source directory. This ensures the directory structure is correct.

    if [ -d "${ROOTFS_DIR}/etc" ] ; then
        install -d "${ROOTFS_DIR}/usr/etc"
        cp -a "${ROOTFS_DIR}/etc/." "${ROOTFS_DIR}/usr/etc/"
        rm -rf "${ROOTFS_DIR}/etc"
    fi

Signed-off-by: Tulip Blossom <tulilirockz@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants