Skip to content

关于 Scorpio 模块挂载后执行权限缺失的 Bug #924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
kjx52 opened this issue Mar 26, 2025 · 1 comment
Closed
1 task

关于 Scorpio 模块挂载后执行权限缺失的 Bug #924

kjx52 opened this issue Mar 26, 2025 · 1 comment
Labels
bug Something isn't working FUSE

Comments

@kjx52
Copy link
Contributor

kjx52 commented Mar 26, 2025

一、Bug 内容

目前已验证的 Bug 包括

  • 执行 mount 操作后对应目录下文件权限配置错误,非预期的缺少执行权限(x)。

二、描述及复现

描述

未挂载时/卸载后的权限为:

  • 文件:-rwxr-xr-x (755)
  • 文件夹:drwxr-xr-x (755)

在按照正确流程使用 Scorpio 模块执行 mount 操作后,预计的权限应为:

  • 文件:-rwxrwxrwx (777);
  • 文件夹:drwxrwxrwx(777)。
    而实际为
  • 普通用户:
    • 文件:-rw-rw-r-- (664);
    • 文件夹:drwxrwxr-x(775)。
  • root:
    • 文件:-rw-rw-rw- (666);
    • 文件夹:drwxrwxrwx(777)。

Image

复现

注:下列操作均使用普通用户,root 与普通用户步骤相同。

  1. 拉取 Docker 并部署 Mega 服务。
    这里使用了自动部署脚本
#!/usr/bin/env bash
# Docker 初始化脚本
# init script for Docker
#
# 2025/3/24

docker pull genedna/mega:mono-pg-0.1-pre-release;
docker pull genedna/mega:mono-engine-0.1-pre-release;
docker pull genedna/mega:mono-ui-0.1-pre-release;

# 2. Initialize for mono-engine and PostgreSQL

cd /home/skiner/桌面/mega;
# Linux or MacOS
./docker/init-volume.sh /tmp/data ./docker/config.toml;


# 3. Run the mono-engine and PostgreSQL with docker, and open the mono-ui in your browser with `http://localhost:3000`.

# create network
docker network create mono-network;

# run postgres
docker run --rm -it -d --name mono-pg --network mono-network -v /tmp/data/mono/pg-data:/var/lib/postgresql/data -p 5432:5432 genedna/mega:mono-pg-0.1-pre-release;
docker run --rm -it -d --name mono-engine --network mono-network -v /tmp/data/mono/mono-data:/opt/mega -p 8000:8000 genedna/mega:mono-engine-0.1-pre-release;
docker run --rm -it -d --name mono-ui --network mono-network -e MEGA_INTERNAL_HOST=http://mono-engine:8000 -e MEGA_HOST=http://localhost:8000 -p 3000:3000 genedna/mega:mono-ui-0.1-pre-release;
  1. 修改 mega/scorpio/config.toml 为:
works = []
  1. 修改 /workspaces/mega/scorpio/scorpio.toml 为:
[config]
base_url = "http://localhost:8000"

workspace = "/home/<用户名>/megadir/mount"

store_path = "/home/<用户名>/megadir/store"

git_author = "MEGA"

git_email = "[email protected]"

file_blob_endpoint = "http://localhost:8000/api/v1/file/blob"

config_file = "config.toml"
  1. 创建工作目录、下载 Mega 仓库并将其 push 到 Mega 服务。
    这里使用了自动化脚本
#!/usr/bin/env bash
# FUSE 系统初始化脚本
# init script for FUSE system
#
# 2025/3/24

function show_time() {
	printf "\033[32m[$(date +'%Y-%m-%d %H:%M:%S')]\033[0m $(pwd)\t: $1\n";
}

function git_option() {
	SOR="https://github.com/web3infra-foundation/mega.git";
	show_time "Git sourse: \033[32;1m$SOR\033[0m, target to: \033[32;1m$1\033[0m";

	git clone $SOR;
	
	show_time "Clone completed, commit it.";
	cd mega;
	# add an excute file.
	echo "echo HelloRust" > scorpio/1.sh;
	git add .;
	git commit -m "Add the crate.";
	git branch -a;

	show_time "Set upstream and push to Mega.";
	git push --set-upstream $1 main;
	git push $1;
	
	show_time "Done!";
}

function clean_tmp_data() {
	show_time "Clean $1 dir.";
	rm -rf $1;
}

function checked_create_dir() {
	if [ -d "$1" ]; then
		show_time "$1 is already exist.";
		read -p "Delete them?[Y/n]" KEYC;
		case $KEYC in 
			Y | y )
				clean_tmp_data $1;
				mkdir -p $1;
			;;
			N | n )
				show_time "If there is a trouble between two folders, try to del the older.";
			;;
			*)
				clean_tmp_data $1;
				mkdir -p $1;
			;;
		esac
	else
		show_time "$1 is not exist, create it.";
		mkdir -p $1;
	fi
}

function loop_mkdir() {
	for i in "$@"; do
	    checked_create_dir $i;
	done
}

show_time "\033[1mStart.\033[0m";

USERN=$(whoami);
if [ "$USERN" = "root" ];then
	USERR="/root";
else
	USERR="/home/$USERN";
fi
show_time "You are $USERN.";

show_time "Create workspace.";
loop_mkdir "$USERR/megadir/mount" "$USERR/megadir/store"
USERD="$USERR/tmp";

CURRD=$(pwd);
checked_create_dir $USERD;
cd $USERD;

if [ -z $1 ]; then
	TAR="http://localhost:8000/third-part/mega.git";
else
	TAR=$1;
fi
git_option $TAR;

show_time "Back to $CURRD.";
cd $CURRD;

clean_tmp_data $USERD;

show_time "\033[1mComplete.\033[0m";
  1. mega/scorpio 目录下执行 cargo run
    如果一切正确,输入下图中的指令后应当看到相同的结果。

Image

若使用 root 账户或 sudo 组执行上述操作为,则结果会变为:

Image

三、其他

  1. 在 mount 操作后,文件状态没有立即改变(除上述截图外,也可用stat命令证实),而是在 ls 列出操作后才进行的更新,证明该更新应是惰性的。
  2. 对于 Scorpio 模块管辖下的文件夹,除所有者外,包括 root 在内的其他用户都不具有访问权限。
  3. 用户组的问题(需要进一步实验)
@genedna genedna added bug Something isn't working FUSE labels Mar 30, 2025
@genedna genedna added this to Mega Mar 30, 2025
@genedna genedna moved this to In progress in Mega Mar 30, 2025
@kjx52
Copy link
Contributor Author

kjx52 commented Apr 9, 2025

由于创建文件的时候权限默认是 -rw-r--r-- ,所以挂载后无执行权限属正常现象。用户需要手动调用一下 chmod 后运行。

@kjx52 kjx52 closed this as completed Apr 9, 2025
@github-project-automation github-project-automation bot moved this from In progress to Done in Mega Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working FUSE
Projects
Status: Done
Development

No branches or pull requests

2 participants