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

os.rm not work for some folders #3484

Closed
shaqtsui opened this issue Mar 9, 2023 · 10 comments
Closed

os.rm not work for some folders #3484

shaqtsui opened this issue Mar 9, 2023 · 10 comments
Labels

Comments

@shaqtsui
Copy link
Contributor

shaqtsui commented Mar 9, 2023

Xmake Version

2.7.7

Operating System Version and Architecture

Debian 11

Describe Bug

os.rm can not remove some folder.
I have posted related operation & corresponding logs.
Some folder is works, some not.

Expected Behavior

os.rm can remove my folder

Project Configuration

No response

Additional Information and Error Logs

gitlab-runner@test-shaq-d1:~/.xmake/cache/packages/2303/m/msvc/14.34.31933$ ls -al
total 774916
drwxr-xr-x 5 gitlab-runner sudo      4096 Mar  9 16:34 .
drwxr-xr-x 3 gitlab-runner sudo      4096 Mar  9 14:55 ..
drwxr-xr-x 3 gitlab-runner sudo      4096 Mar  9 15:09 installdir.failed
-rw-r--r-- 1 gitlab-runner sudo 793487280 Mar  9 14:55 msvc_14.34.31933.tar.gz
-rw-r--r-- 1 gitlab-runner sudo         0 Mar  9 14:55 package.lock
drwxr-xr-x 8 gitlab-runner sudo      4096 Mar  9 15:08 source
drwxr-xr-x 8 gitlab-runner sudo      4096 Mar  9 16:10 source.tmp
gitlab-runner@test-shaq-d1:~/.xmake/cache/packages/2303/m/msvc/14.34.31933$ xmake l
xmake> os.rm "source.tmp"
@programdir/core/sandbox/modules/os.lua:117: cannot remove directory source.tmp Directory not empty
stack traceback:
        [C]: in function 'error'
        @programdir/core/base/os.lua:912: in function 'os.raiselevel'
        (...tail calls...)
        @programdir/core/sandbox/modules/os.lua:117: in function <@programdir/core/sandbox/modules/os.lua:112>
        (...tail calls...)
        [C]: in function 'sandbox/sandbox.interactive'
        ...dir/core/sandbox/modules/import/core/sandbox/sandbox.lua:102: in field 'interactive'
        @programdir/plugins/lua/main.lua:179: in function <@programdir/plugins/lua/main.lua:160>
        (...tail calls...)
        [C]: in function 'xpcall'
        @programdir/core/base/utils.lua:280: in function 'base/utils.trycall'
        (...tail calls...)
        @programdir/core/base/task.lua:501: in function 'base/task.run'
        @programdir/core/main.lua:300: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>
@shaqtsui shaqtsui added the bug label Mar 9, 2023
@waruqi
Copy link
Member

waruqi commented Mar 9, 2023

try this

#2902 (comment)

@shaqtsui
Copy link
Contributor Author

shaqtsui commented Mar 9, 2023

Seems not same error, for this case the error is : Directory not empty for #2902 is Permission denied
And this happen in linux, I can delete it manually. If occupied by other process, I suppose not able to delete it manually.

@waruqi
Copy link
Member

waruqi commented Mar 9, 2023

Seems not same error, for this case the error is : Directory not empty for #2902 is Permission denied

Due to the many internal operations, the last error obtained may not be completely accurate. It should work.

can you try xmake l os.rm source.tmp? or switch to a new user?

@waruqi
Copy link
Member

waruqi commented Mar 9, 2023

you can also try

mkdir dir
touch dir/xxx
xmake l os.rm dir

@shaqtsui
Copy link
Contributor Author

shaqtsui commented Mar 9, 2023

I tried this. So I mentioned Some folder is works, some not.

@waruqi
Copy link
Member

waruqi commented Mar 9, 2023

Which ones don't work? Can you provide steps that can be replicated?

@shaqtsui
Copy link
Contributor Author

shaqtsui commented Mar 9, 2023

cd ~/.xmake/cache/packages/2303/m/msvc/14.34.31933
mkdir dir
touch dir/xxx
xmake l os.rm "dir"

Works

cd ~/.xmake/cache/packages/2303/m/msvc/14.34.31933
xmake l os.rm "source.tmp"

Not work, but I can run rm -rf source.tmp to delete it.

@waruqi
Copy link
Member

waruqi commented Mar 9, 2023

It is possible that the package msvc_14.34.31933.tar.gz contains some special file or too many subfiles. It causes os.rm to fail to delete.

This is just my guess, but it might just be related to the msvc_14.34.31933.tar.gz package.

but I have not this package, I cannot test it.

@shaqtsui
Copy link
Contributor Author

shaqtsui commented Mar 9, 2023

I have the same package used in Ubuntu, no such issue. I can share my screen for you to test. If you are willing.

@waruqi
Copy link
Member

waruqi commented Mar 9, 2023

I don't have the time to do real-time technical support. you can provide your msvc_14.34.31933.tar.gz package or package configuration. I will test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants