From dd9341d9d589dd200dc78feca7ec5b3265032202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Fri, 20 Mar 2026 08:55:39 +0100 Subject: [PATCH] chore(orch): split mkfs.ext4 feature flags into individually commentable slice Replace the single comma-separated string literal for mkfs.ext4 -O with strings.Join over a slice, so each ext4 feature flag can be commented individually. Flags are sorted alphabetically within the main group, with ^orphan_file separated at the end as a guest-compatibility workaround. Original comments describing the feature set rationale (tar2ext4 matching, kept defaults, orphan_file compat) are preserved in place. No functional change - produces the identical argument string at runtime. Addresses review feedback from #2082. Link: https://github.com/e2b-dev/infra/pull/2082#discussion_r2961579937 --- .../template/build/core/filesystem/ext4.go | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/orchestrator/internal/template/build/core/filesystem/ext4.go b/packages/orchestrator/internal/template/build/core/filesystem/ext4.go index 6022ed7ee1..ca32f0cf84 100644 --- a/packages/orchestrator/internal/template/build/core/filesystem/ext4.go +++ b/packages/orchestrator/internal/template/build/core/filesystem/ext4.go @@ -41,14 +41,28 @@ func Make(ctx context.Context, rootfsPath string, sizeMb int64, blockSize int64) cmd := exec.CommandContext(ctx, "mkfs.ext4", - // Matches the final ext4 features used by tar2ext4 tool - // But enables resize_inode, sparse_super (default, required for resize_inode), has_journal (default), metadata_csum (default). - // orphan_file is disabled (added as default in e2fsprogs >= 1.47.0) to ensure guest e2fsprogs tools - // (tune2fs, resize2fs, e2fsck) from older images (e.g. Ubuntu 22.04, Debian 11) can write to - // the filesystem. Without this, any write operation from the guest fails with "unsupported - // read-only feature(s)" when the host e2fsprogs is newer than the guest's. - // See https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0 - "-O", `^dir_index,^64bit,^dir_nlink,^orphan_file,ext_attr,sparse_super2,filetype,extent,flex_bg,large_file,huge_file,extra_isize`, + "-O", strings.Join([]string{ + // Matches the final ext4 features used by tar2ext4 tool. + // But enables resize_inode, sparse_super (required for resize_inode), + // has_journal, and metadata_csum are kept as defaults. + "^64bit", + "^dir_index", + "^dir_nlink", + "ext_attr", + "extent", + "extra_isize", + "filetype", + "flex_bg", + "huge_file", + "large_file", + "sparse_super2", + + // Disabled for compatibility with older guest e2fsprogs (Ubuntu 22.04, Debian 11). + // orphan_file was added as default in e2fsprogs >= 1.47.0; without disabling it, + // guest tools fail with "unsupported read-only feature(s)". + // See https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0 + "^orphan_file", + }, ","), "-b", strconv.FormatInt(blockSize, 10), "-m", strconv.FormatInt(reservedBlocksPercentage, 10), "-i", strconv.FormatInt(inodesRatio, 10),