Skip to content

Makefile: fix filesystem permissions

Jeremy Soller requested to merge genodeftest:fix-fs-permissions into master

Created by: genodeftest

Problem:

  • On my build machine with umask set to 0077, folders and executables were created with incorrect permissions, preventing redox from booting up correctly, most notably being unable to do anything as user.
  • Some permissions were wrong, e.g. on /etc/passwd
  • when build failed, filesystem was kept mounted under some circumstances, leaving a broken build directory

Solution:

  • set right permissions even if build machine has umask 0077
  • /etc/passwd must not be readable by user
  • include directories for setting permissions
  • make sure filesystem gets unmounted if build fails
  • exclude others from /home/user and /root directories
  • set executable bit in /bin/ even if build machine umask tries to prevent that

Changes introduced by this pull request:

  • permissions
  • unmounting filesystem more often if build fails

Drawbacks: Unclear: When starting the file manager, I get a bunch of errors:

Failed to load icon inode-directory: failed to open image: Permission denied (os error 13)
Failed to load icon audio-x-wav: failed to open image: Permission denied (os error 13)
Failed to load icon application-x-executable: failed to open image: Permission denied (os error 13)
Failed to load icon image-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon image-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-makefile: failed to open image: Permission denied (os error 13)
Failed to load icon application-x-object: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-makefile: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-makefile: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-csrc: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-c++src: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-chdr: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-script: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-script: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-script: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-script: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon text-x-generic: failed to open image: Permission denied (os error 13)
Failed to load icon unknown: failed to open image: Permission denied (os error 13)

I think they are not related to my changes, but I'm not sure. Can somebody please check this?

TODOs: See Drawbacks. I need somebody else to check I'm not wrong.

Fixes: None reported to github.

State: Ready except for the single TODO above.

Blocking/related: None

Merge request reports