Skip to content

copyExecutable function overwrites file perfmission for non owners #125

@xerial

Description

@xerial

In the current implementation, copyExecutable does not favor the original file permission except the file owner:

  /** Transfers the executable property of `sourceFile` to `targetFile`. */
  def copyExecutable(sourceFile: File, targetFile: File) = {
    val executable = sourceFile.canExecute
    if (executable) targetFile.setExecutable(true) /// equivalent to  setExecutable(executable=true, ownerOnly=true)
  }

For example, if the original file permission is 775 (rwxrwxr-x), and copied by sbt.io.IO.copyExecutable, it will results in 764 (rwxrw-r--) executable flag are removed from the group and others).

We've found this issue in xerial/sbt-pack#135

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions