You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by dhpeterson <dh...@gmail.com> on 2008/01/30 00:25:49 UTC

Zip task not respecting file permissions?


Hi all,

I'm packaging up various components in a ZIP archive and I've noticed that
my execute bit (755) file permissions keep getting stripped from files
during the zip step. Has anyone else noticed this behaviour?

Specifically, I have tried two ways:

1. Direct include of mode-x (755) files

I have some resources (script files) sitting in a sub-directory of my
resources/ path. When I package them into a zip file using the below task,
the executable bit permissions are lost.

  package(:zip).include _("src/main/resources/etc/*"), :path =>
"#{id}-#{version}/."         

2. Merge of a ZIP file containing correct file permissions

I made a "blah.zip" file containing a "blah/" directory which had certain
files that were executable. I then merged this zip against my main zip file
to produce a resultant file using the task:

  package(:zip).merge("blah.zip", :path => "#{id}-#{version}/.")

When I re-opened file resultant ZIP file and navigated to the blah/
directory, the file permissions of the files within this directory have
reverted to 644.


I've tried a couple of ways now and I keep meeting the same issue. I have
set svn:executable property onto each of the files, and it didn't make any
difference.


Is this a bug in the implementation of the Zip task? Help/guidance
appreciated (as always). If it is a bug, I am happy to raise an issue/report
in JIRA. Just let me know.


Dave

-- 
View this message in context: http://www.nabble.com/Zip-task-not-respecting-file-permissions--tp15172035p15172035.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Zip task not respecting file permissions?

Posted by To...@KE4KUG.net.
I noticed that the tarball task exhibits the same defect, but I  
haven't yet had a chance to dig into the code & fix it.
I'd like to add my voice to the list of folks who'd like to see this  
fixed.
Sorry, I haven't had time myself to contribute lately.

Thanks,
/Tommy

On Jan 29, 2008, at 4:25 PM, dhpeterson wrote:

>
>
> Hi all,
>
> I'm packaging up various components in a ZIP archive and I've  
> noticed that
> my execute bit (755) file permissions keep getting stripped from files
> during the zip step. Has anyone else noticed this behaviour?
>
> Specifically, I have tried two ways:
>
> 1. Direct include of mode-x (755) files
>
> I have some resources (script files) sitting in a sub-directory of my
> resources/ path. When I package them into a zip file using the below  
> task,
> the executable bit permissions are lost.
>
>  package(:zip).include _("src/main/resources/etc/*"), :path =>
> "#{id}-#{version}/."
>
> 2. Merge of a ZIP file containing correct file permissions
>
> I made a "blah.zip" file containing a "blah/" directory which had  
> certain
> files that were executable. I then merged this zip against my main  
> zip file
> to produce a resultant file using the task:
>
>  package(:zip).merge("blah.zip", :path => "#{id}-#{version}/.")
>
> When I re-opened file resultant ZIP file and navigated to the blah/
> directory, the file permissions of the files within this directory  
> have
> reverted to 644.
>
>
> I've tried a couple of ways now and I keep meeting the same issue. I  
> have
> set svn:executable property onto each of the files, and it didn't  
> make any
> difference.
>
>
> Is this a bug in the implementation of the Zip task? Help/guidance
> appreciated (as always). If it is a bug, I am happy to raise an  
> issue/report
> in JIRA. Just let me know.
>
>
> Dave
>
> -- 
> View this message in context: http://www.nabble.com/Zip-task-not-respecting-file-permissions--tp15172035p15172035.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>


Re: Zip task not respecting file permissions?

Posted by Assaf Arkin <ar...@intalio.com>.
On 1/29/08, dhpeterson <dh...@gmail.com> wrote:
>
> Assaf Arkin wrote:
> >
> > Dave,
> >
> > Right now permissions are not copied from the file, and there's no way
> to
> > set them when including a file (i.e. :mode=>... option)  We have an open
> > issue for that:
> > http://issues.apache.org/jira/browse/BUILDR-23
> >
> > Assaf
> >
> >
>
> Thanks Assaf. I don't know why I didn't see this in JIRA :)
>
> Rather than a ":mode => option" attribute, shouldn't the defaukt behaviour
> just be to check and respect the existing file permissions on the files?
> :mode => xxx would only be needed to override this.


That's a good question.  Tommy actually suggested this a while back, and
after thinking about it I like his idea better than the one I had before.
The one I had before was to copy the file permission from the included file.

File permissions don't preserve well when you're doing things like sharing
them through source control, so if you have a script directory like
src/main/bin, you'll need to fix the permission before including the file.
Something like running chmod on the file before including it.

At least one very common operating system ignores file permissions
altogether, so the above trick won't work.  But you can still include files
with the right permission by setting them in the zip/tar entry.

Copying the file's permission will be simpler if everyone on the project is
running a UNIX-based operating system, and files have the correct
permissions.  Otherwise, you end up with different machines generating
different (some incorrect) builds.  Picking one mode by default, and then
using an option to override it, forces you to create a buildfile that will
work the same way in every environment.

Assaf

Dave
>
>
> --
> View this message in context:
> http://www.nabble.com/Zip-task-not-respecting-file-permissions--tp15172035p15173135.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>
>

Re: Zip task not respecting file permissions?

Posted by dhpeterson <dh...@gmail.com>.



Assaf Arkin wrote:
> 
> Dave,
> 
> Right now permissions are not copied from the file, and there's no way to
> set them when including a file (i.e. :mode=>... option)  We have an open
> issue for that:
> http://issues.apache.org/jira/browse/BUILDR-23
> 
> Assaf
> 
> 

Thanks Assaf. I don't know why I didn't see this in JIRA :)

Rather than a ":mode => option" attribute, shouldn't the defaukt behaviour
just be to check and respect the existing file permissions on the files?
:mode => xxx would only be needed to override this.

Dave


-- 
View this message in context: http://www.nabble.com/Zip-task-not-respecting-file-permissions--tp15172035p15173135.html
Sent from the Buildr - User mailing list archive at Nabble.com.


Re: Zip task not respecting file permissions?

Posted by Assaf Arkin <ar...@intalio.com>.
Dave,

Right now permissions are not copied from the file, and there's no way to
set them when including a file (i.e. :mode=>... option)  We have an open
issue for that:
http://issues.apache.org/jira/browse/BUILDR-23

Assaf

On 1/29/08, dhpeterson <dh...@gmail.com> wrote:
>
>
>
> Hi all,
>
> I'm packaging up various components in a ZIP archive and I've noticed that
> my execute bit (755) file permissions keep getting stripped from files
> during the zip step. Has anyone else noticed this behaviour?
>
> Specifically, I have tried two ways:
>
> 1. Direct include of mode-x (755) files
>
> I have some resources (script files) sitting in a sub-directory of my
> resources/ path. When I package them into a zip file using the below task,
> the executable bit permissions are lost.
>
>   package(:zip).include _("src/main/resources/etc/*"), :path =>
> "#{id}-#{version}/."
>
> 2. Merge of a ZIP file containing correct file permissions
>
> I made a "blah.zip" file containing a "blah/" directory which had certain
> files that were executable. I then merged this zip against my main zip
> file
> to produce a resultant file using the task:
>
>   package(:zip).merge("blah.zip", :path => "#{id}-#{version}/.")
>
> When I re-opened file resultant ZIP file and navigated to the blah/
> directory, the file permissions of the files within this directory have
> reverted to 644.
>
>
> I've tried a couple of ways now and I keep meeting the same issue. I have
> set svn:executable property onto each of the files, and it didn't make any
> difference.
>
>
> Is this a bug in the implementation of the Zip task? Help/guidance
> appreciated (as always). If it is a bug, I am happy to raise an
> issue/report
> in JIRA. Just let me know.
>
>
> Dave
>
> --
> View this message in context:
> http://www.nabble.com/Zip-task-not-respecting-file-permissions--tp15172035p15172035.html
> Sent from the Buildr - User mailing list archive at Nabble.com.
>
>