Skip to content

chmod issues #19

@orlitzky

Description

@orlitzky

Hello, I've encountered two issues with the way directory permissions are handled. The code (repeated twice) looks like,

if ( ! defined( 'FS_CHMOD_DIR' ) ) {
  define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
}

// If the fonts folder don't exist, create it.
if ( ! file_exists( $this->get_fonts_folder() ) ) {
  $this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR );
}

There are two problems, but the second subsumes the first, so I'll start with the easy one:

  1. I don't think it's right to use the global constant FS_CHMOD_DIR as what is essentially a temporary variable here. If some other code calls these public functions, then FS_CHMOD_DIR will become defined globally, and will affect the permissions of any other directory that is created -- not just the fonts directories.

But the bigger issue is that...

  1. You really shouldn't need chmod at all. On our systems, for example, it breaks our ACLs. And in general it doesn't solve any problems that aren't better solved in some other way. I've written a long explanation of this at chmod breaks ACLs keycdn/cache-enabler#320, so maybe you can forgive me for not reproducing it here.

Of course, if you forego the chmod entirely, the unintended FS_CHMOD_DIR side effects cease to matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions