-
Notifications
You must be signed in to change notification settings - Fork 48
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
ensure 0644 perms for /etc/pam.d/system
#387
ensure 0644 perms for /etc/pam.d/system
#387
Conversation
9642b37
to
624717e
Compare
Doing this as a one-off for /etc/pam.d/system sounds wrong, surely we should set the right permissions for other files too, i.e. give create_file_for_image a sensible default? |
Hi @jrtc27, I'm not sure if give create_file_for_image a default would break other things, and it might be okay to add this one-off for the reasons below. Firstly, there're already quite a few one-offs in the codebase, such as: cheribuild/pycheribuild/projects/disk_image.py Lines 356 to 379 in af47e1d
Meanwhile, there're also a dozen of calls to this function didn't specify the desired file permissions, i.e., cheribuild/pycheribuild/projects/disk_image.py Lines 309 to 329 in af47e1d
And for these files that without being explicitly set permissions, they will be created by cheribuild/pycheribuild/filesystemutils.py Line 215 in af47e1d
which sets default permissions based on current umask value. And that leads to the final reason that, if the umask value is changed somewhere else during the build, and they depend on this default behaviour, then giving create_file_for_image a default could cause incorrect file permissions. |
Since there aren't that many calls I think requiring the mode argument probably makes sense and avoids problems like this in the future |
@cocoa-xu would you be able to update this PR with add an explicit argument added to the other calls as well? |
Sure thing! I'll do that in a minute |
ada31ed
to
ec6957f
Compare
You seem to have typo'ed 644 as 664 in some places |
Hi @jrtc27, sorry I was copying file permissions from the system image built by the script. They should all be corrected now, but please do let me know if there're any more mistakes, and I'll correct them as soon as possible. And I guess this also suggests that these files have wrong file permissions set all the time, and we indeed need to explicitly specify their permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks this looks good now, @jrtc27 do you agree?
I can remove the default argument in a future change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM subject to cleaning up the commit message on squash
Hi, I noticed that the file permission of
/etc/pam.d/system
is incorrect when I was using the minimal disk image. It prompts that:And if I log out the system, I can never log in back.
This PR tries to fix this issue by ensuring the file permission of
/etc/pam.d/system
to be0644
when building the rootfs. After applying this patch, I can log out and log in again without any issue.