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

Permission handling problem in /tmp/.dotnet #437

Closed
mkeuschn opened this issue Dec 20, 2022 · 4 comments
Closed

Permission handling problem in /tmp/.dotnet #437

mkeuschn opened this issue Dec 20, 2022 · 4 comments

Comments

@mkeuschn
Copy link
Contributor

mkeuschn commented Dec 20, 2022

After the last update the permissions of the session folder has changed.

Access permissions before update:

sh-4.4$ ls -la
total 0
drwxrwxrwx. 1 default root 22 Dec 13 20:51 .
drwxrwxrwx. 1 default root 17 Dec 13 20:51 ..
drwxrwxrwx. 1 default root  6 Dec 19 14:27 session1

Access permissions after update:

sh-4.4$ ls -la
total 0
drwxrwxrwt. 3 default root  22 Dec 16 11:04 .
drwxrwxrwx. 3 default root  17 Dec 16 11:04 ..
drwx------. 2 default root 104 Dec 16 11:07 session1

In WSL(Ubuntu) the permissions are:

/tmp/.dotnet/shm$ ls -la
total 12
drwxrwxrwt 3 bugs bugs 4096 Dec 19 15:18 .
drwxrwxrwx 3 bugs bugs 4096 Dec 19 15:18 ..
drwx------ 2 bugs bugs 4096 Dec 19 15:18 session82

During the build an session folder is created by the default user. In app run mode another user is used. (Maybe the tmp folder should be deleted at the end of the build?)

This caused an error for some operations in c# (e.g. Create Mutex).

Sample Project: https://github.com/mkeuschn/named-mutex

SO: https://stackoverflow.com/questions/74823773/create-mutex-throws-error-the-system-cannot-open-the-device-or-file-specified

Workaround

I have added my own assemble file to delete the session folders.

#!/bin/bash
echo "Before assembling"

/usr/libexec/s2i/assemble
rc=$?

if [ $rc -eq 0 ]; then
    echo "After successful assembling"
	echo "Delete /tmp/.dotnet/shm/*"
	rm -rf /tmp/.dotnet/shm/*
else
    echo "After failed assembling"
fi

exit $rc

Now it is working as expected.

@tmds
Copy link
Member

tmds commented Dec 21, 2022

Thanks for reporting the issue, and the clear report.

I have added my own assemble file to delete the session folders.

Do you want to make a PR that adds this to the default assemble file?
If not, I will look into making the change.

cc @aslicerh @omajid

@mkeuschn
Copy link
Contributor Author

Thanks for reporting the issue, and the clear report.

I have added my own assemble file to delete the session folders.

Do you want to make a PR that adds this to the default assemble file? If not, I will look into making the change.

cc @aslicerh @omajid

I have created a pull request.

@tmds
Copy link
Member

tmds commented Jan 12, 2023

Fixed by #439.

@tmds tmds closed this as completed Jan 12, 2023
@tmds
Copy link
Member

tmds commented Aug 16, 2023

fyi, the changed that cause this permission issue is being reverted: dotnet/runtime#90342.

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

No branches or pull requests

2 participants