Skip to content
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

#89: Implemented packArchivePosixMask mechanism #90

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

norru
Copy link

@norru norru commented Sep 24, 2015

Hi,

I managed to implement a possible solution at #89.

The following setting implements the desired behaviour

packArchivePosixMask := posixMaskFromFilesystem

The following setting implements the default behaviour

packArchivePosixMask := posixMaskFromBinPath(Pack.packTargetDir.value / Pack.packDir.value)

The following setting prevents masks from being set in the archive

packArchivePosixMask := posixMaskNone

It should be ready for you to review, adjust and integrate

Cheers
Nico

@xerial
Copy link
Owner

xerial commented Oct 23, 2015

Sorry for the delay of response. I have failed to notice this PR.
I'll review the commits.

Thanks

@xerial xerial self-assigned this Oct 23, 2015
Some(mask)
}

def posixMaskNone(_unused: File): Option[Int] =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not used.

@xerial
Copy link
Owner

xerial commented Nov 9, 2015

For your purpose, I think having a setting packArchiveFilePermission, whose type would be Function[File, Option[Int]] or PartialFunction[File, Int], is sufficient.

And the default flow is simple as follows:

  1. If the file is inside bin folder, its permission will be 755
  2. Otherwise, use the same flag with the file system.

Rather than defining multiple functions (posixXXX, posixNone, etc.) for setting posix permission, it would be better to define a function as follows (pseudo code):

  def defaultFilePermission(file:File) : Function[File, Int] = {
     case f if (f is under bin folder) =>  Integer.parseInt("0755", 8)
     case other => posixMaskOfTheFileSysetem(other)
  }

  posixArchiveFilePermission := defaultFilePermission

And also, rather than using Int, allowing to use String (posix mask string)] might be easier to use.

@norru
Copy link
Author

norru commented Nov 9, 2015

I'll have a look.

The functions are provided to be assigned as posixArchiveFilePermission
predefined settings.

Octal mask definition tends to be more common than "rwxrwx" style. Is that
whay you intended?

On 9 November 2015 at 00:28, Taro L. Saito [email protected] wrote:

For your purpose, I think having a setting packArchiveFilePermission,
whose type would be Function[File, Option[Int]] or PartialFunction[File,
Int], is sufficient.

And the default flow is simple as follows:

  1. If the file is inside bin folder, its permission will be 755
  2. Otherwise, use the same flag with the file system.

Rather than defining multiple functions (posixXXX, posixNone, etc.) for
setting posix permission, it would be better to define a function as
follows (pseudo code):

def defaultFilePermission(file:File) : Function[File, Int] = {
case f if (f is under bin folder) => Integer.parseInt("0755", 8)
case other => posixMaskOfTheFileSysetem(other)
}

posixArchiveFilePermission := defaultFilePermission

Rather than using Int, allowing to use String (posix mask string)] might
be easier to use.


Reply to this email directly or view it on GitHub
#90 (comment).

Cheers,
Nico

@norru
Copy link
Author

norru commented Nov 9, 2015

When you say posix mask string, do you mean the octal representation of
the mask, as in "0755"? If it's the case, it sounds good to me.
Ta

On 9 November 2015 at 10:56, Nicola Orrù [email protected] wrote:

I'll have a look.

The functions are provided to be assigned as posixArchiveFilePermission
predefined settings.

Octal mask definition tends to be more common than "rwxrwx" style. Is that
whay you intended?

On 9 November 2015 at 00:28, Taro L. Saito [email protected]
wrote:

For your purpose, I think having a setting packArchiveFilePermission,
whose type would be Function[File, Option[Int]] or PartialFunction[File,
Int], is sufficient.

And the default flow is simple as follows:

  1. If the file is inside bin folder, its permission will be 755
  2. Otherwise, use the same flag with the file system.

Rather than defining multiple functions (posixXXX, posixNone, etc.) for
setting posix permission, it would be better to define a function as
follows (pseudo code):

def defaultFilePermission(file:File) : Function[File, Int] = {
case f if (f is under bin folder) => Integer.parseInt("0755", 8)
case other => posixMaskOfTheFileSysetem(other)
}

posixArchiveFilePermission := defaultFilePermission

Rather than using Int, allowing to use String (posix mask string)] might
be easier to use.


Reply to this email directly or view it on GitHub
#90 (comment).

Cheers,
Nico

Cheers,
Nico

@xerial
Copy link
Owner

xerial commented Nov 9, 2015

do you mean the octal representation of the mask, as in "0755"

Yes. And it would be better to allow "755" too.

@norru
Copy link
Author

norru commented Nov 11, 2015

Ok, sounds sensible :)

On 9 November 2015 at 20:59, Taro L. Saito [email protected] wrote:

do you mean the octal representation of the mask, as in "0755"
Yes. And it would be better to allow "755" too.


Reply to this email directly or view it on GitHub
#90 (comment).

Cheers,
Nico

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants