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

Store executable permission of files not in /bin/ for universal-plugin #695

Open
avdv opened this issue Nov 11, 2015 · 6 comments
Open

Store executable permission of files not in /bin/ for universal-plugin #695

avdv opened this issue Nov 11, 2015 · 6 comments
Labels
bug universal Zip, tar.gz, tgz and bash issues

Comments

@avdv
Copy link

avdv commented Nov 11, 2015

We're using sbt universal:packageZipTarball to create a tgz from our Play project. (using sbt-native-packager 1.0.1)

There's a file which is not in a "bin" folder but has executable permissions set.

When copied to target/universal/stage the permissions remain.

But, when copied to /tmp/sbt_XXXXX/... the executable bits have vanished, the permissions are set to 0644.

@muuki88 muuki88 added the universal Zip, tar.gz, tgz and bash issues label Nov 11, 2015
@muuki88
Copy link
Contributor

muuki88 commented Nov 11, 2015

What OS are you using to build your package? MacOS has some issue preserving the executable bit.

@muuki88 muuki88 added the bug label Nov 11, 2015
@avdv
Copy link
Author

avdv commented Nov 12, 2015

I'm using Linux.

I was also wondering why the first copying into the staging area keeps the permissions, but the second copy operation does not. I suspected the reason being that tmpfs was involved or that the copy operation crosses file system boundaries. So I started sbt with java.io.tmpdir set to a directory on the same file system as the project files, but there was no difference.

@avdv
Copy link
Author

avdv commented Apr 11, 2016

I looked into this again, and I must have been blind...

Of course, the permissions are not copied over to the tmp folder because IO.copyFile does not support this, basically it's just like "create new File; open old File; copy data over" - it doesn't deal with permissions at all, AFAICS.

So, how about changing to https://github.com/sbt/sbt-native-packager/blob/master/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala#L234 to something like:

      for (f, t <- m2 if f.isDirectory || f.canExecute) {
        t.setExecutable(true, false)
      }

@muuki88
Copy link
Contributor

muuki88 commented Apr 13, 2016

I think we need to keep the other logic as well f.path contains "/bin/", as I think this maybe the reason the executable permissions are there in the first place :/

However if this is not the case, then your solution would be a way better as it is clear what happens.

We could also try using Java7 NIO for this?

@tenggyut
Copy link

tenggyut commented Jul 6, 2016

any updates? will this be fixed in version 1.2.0?

@muuki88
Copy link
Contributor

muuki88 commented Jul 6, 2016

If you provide a pull request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

No branches or pull requests

3 participants