From 42f0b0c277bd7183c66b6266ac290f03c16856a0 Mon Sep 17 00:00:00 2001 From: Hongzhen Luo Date: Mon, 2 Dec 2024 19:11:33 +0800 Subject: [PATCH] [EROFS] fix the loss of uid and gid Currently, the uid and gid in the tar file are lost because the `c_uid` and `c_gid` of `erofs_cfg` are not set to -1. This patch fixes it. Signed-off-by: Hongzhen Luo --- src/overlaybd/tar/erofs/CMakeLists.txt | 2 +- src/overlaybd/tar/erofs/liberofs.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlaybd/tar/erofs/CMakeLists.txt b/src/overlaybd/tar/erofs/CMakeLists.txt index 8e988163..6027102e 100644 --- a/src/overlaybd/tar/erofs/CMakeLists.txt +++ b/src/overlaybd/tar/erofs/CMakeLists.txt @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( erofs-utils GIT_REPOSITORY https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git - GIT_TAG 80156068eb4980342c0ad3ee47ac7261acce5caf + GIT_TAG eec6f7a2755dfccc8f655aa37cf6f26db9164e60 ) FetchContent_MakeAvailable(erofs-utils) diff --git a/src/overlaybd/tar/erofs/liberofs.cpp b/src/overlaybd/tar/erofs/liberofs.cpp index 24fa1dab..536127ca 100644 --- a/src/overlaybd/tar/erofs/liberofs.cpp +++ b/src/overlaybd/tar/erofs/liberofs.cpp @@ -25,6 +25,8 @@ struct erofs_mkfs_cfg { static int rebuild_src_count; +extern void erofs_init_configure(void); + int erofs_mkfs(struct erofs_mkfs_cfg *mkfs_cfg) { int err; @@ -280,6 +282,7 @@ int LibErofs::extract_tar(photon::fs::IFile *source, bool meta_only, bool first_ mkfs_cfg.sbi = &sbi; mkfs_cfg.erofstar = &erofstar; mkfs_cfg.incremental = !first_layer; + erofs_init_configure(); erofs_cfg = erofs_get_configure(); erofs_cfg->c_ovlfs_strip = true; if (first_layer)