Skip to content

Avoid chmod() calls on directories

Matthieu Herrb requested to merge mherrb/fontconfig:no-chmod into master

There are several reasons for that:

  • the reason that triggered this patch is that the pledge() sandboxing system on OpenBSD forbids chmod() by default in many pledged applications. When one of these needs to rebuild the font cache it will fail because of these unneeded chmod() calls.
  • trying to change existing directories access rights isn't a good idea
  • and lastly doing mkdir() && chmod() is racy. Use umask() to make shure the directory is created with the proper access rights from start.

Note that this will revert the fix for https://bugs.freedesktop.org/show_bug.cgi?id=18934

If a user decides to shoot himself in the foot with a bad umask, fontconfig shouldn't try to prevent it. (other programs like vi or cc won't)

The system cache should be generated with umask 022 explicitely, like that to avoid umask issues:

# umask 022 ; fc-cache -s -v

Signed-off-by: Matthieu Herrb matthieu@herrb.eu

Merge request reports