Skip to content
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

REMOVE变量与system/product同时使用时挂载到错误的路径 #1261

Open
3 tasks done
Greyh4t opened this issue Jan 6, 2024 · 2 comments · May be fixed by #1262
Open
3 tasks done

REMOVE变量与system/product同时使用时挂载到错误的路径 #1261

Greyh4t opened this issue Jan 6, 2024 · 2 comments · May be fixed by #1262

Comments

@Greyh4t
Copy link

Greyh4t commented Jan 6, 2024

Please check before submitting an issue

  • I have searched the issues and haven't found anything relevant
  • I will upload bugreport file in KernelSU Manager - Settings - Report log
  • I know how to reproduce the issue which may not be specific to my device

Describe the bug

模块里面设置 REMOVE 变量,并且 REMOVE 变量包含 /product/ 开头的路径,同时创建 system/product/test_file 文件,打包后刷进去,test_file 会被错误地挂载到 /product/product/test_file,出现了两层 product 目录,去模块目录下看到文件的路径是 system/product/product/test_file
按照文档的的说明,如果要在 /product 替换文件,需要将文件放到 system/product 目录下,所以两层 product 应该是 bug 吧

To Reproduce

这个是复现问题的模块

kernelsudebug.zip

Expected behavior

No response

Screenshots

No response

Logs

KernelSU_bugreport_2024-01-07_01_58.tar[1].gz

Device info

  • Device: xiaomi14
  • OS Version: HyperOS 1.0.28.0.UNCCNXM
  • KernelSU Version: 0.72(11413)
  • Kernel Version: 6.1.25-android14-11-g923d9e76856e

Additional context

No response

@Greyh4t Greyh4t changed the title REMOVE变量与/system/product同时使用时存在bug REMOVE变量与system/product同时使用时存在bug Jan 6, 2024
@Greyh4t Greyh4t changed the title REMOVE变量与system/product同时使用时存在bug REMOVE变量与system/product同时使用时挂载到错误的路径 Jan 6, 2024
@Greyh4t
Copy link
Author

Greyh4t commented Jan 6, 2024

看了一下,问题应该是出在

mv -f $MODPATH/system/$1 $MODPATH/$1 && ln -sf ../$1 $MODPATH/system/$1

$1product,这个命令就等效于
mv -f $MODPATH/system/product $MODPATH/product && ln -sf ../$1 $MODPATH/system/product

如果 $MODPATH/product 已经是一个文件夹,$MODPATH/system/product 就会被移动到 $MODPATH/product 里面去,出现两层 product 嵌套的情况,恰巧 REMOVE 变量在这之前处理,会创建 $MODPATH/product 文件夹,这样看的话应该 REPLACE 也有类似的问题

改成下面这样应该能修复这个bug
mv -f $MODPATH/system/$1 $MODPATH/ && ln -sf ../$1 $MODPATH/system/$1

@Greyh4t Greyh4t linked a pull request Jan 6, 2024 that will close this issue
@Greyh4t
Copy link
Author

Greyh4t commented Jan 8, 2024

看了一下,问题应该是出在

mv -f $MODPATH/system/$1 $MODPATH/$1 && ln -sf ../$1 $MODPATH/system/$1

$1product,这个命令就等效于
mv -f $MODPATH/system/product $MODPATH/product && ln -sf ../$1 $MODPATH/system/product
如果 $MODPATH/product 已经是一个文件夹,$MODPATH/system/product 就会被移动到 $MODPATH/product 里面去,出现两层 product 嵌套的情况,恰巧 REMOVE 变量在这之前处理,会创建 $MODPATH/product 文件夹,这样看的话应该 REPLACE 也有类似的问题

改成下面这样应该能修复这个bug mv -f $MODPATH/system/$1 $MODPATH/ && ln -sf ../$1 $MODPATH/system/$1

改成 mv -f $MODPATH/system/$1 $MODPATH/ && ln -sf ../$1 $MODPATH/system/$1 有bug,会导致目录已经存在的时候mv报错无法合并,改成 cp -rf $MODPATH/system/$1 $MODPATH/ && rm -rf $MODPATH/system/$1 && ln -sf ../$1 $MODPATH/system/$1 应该就没问题了

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 a pull request may close this issue.

1 participant