public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too?
@ 2017-06-18 11:41 Jonas Stein
  2017-06-18 17:16 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Stein @ 2017-06-18 11:41 UTC (permalink / raw)
  To: gentoo-dev

Dear all,

if we compress an executable script
hello.sh
with bzip2 or gzip the result is a file
hello.sh.bz2 or hello.sh.gz
with executable permissions. However it is not executable, of course.

./hello.sh.bz2
"cannot execute binary file: Exec format error"

One can not blame bzip2 for it, because it is exactly what its man page
writes:
"Each compressed file has the same modification date, permissions, and,
when possible, ownership as the corresponding original, so that these
properties can be correctly restored at decompression time."

On gentoo systems we can find many archives with with executable bit by
running

$ find /usr/share/doc/ -executable -type f


* Is it proper to install compressed archives (.zip, .gz, .bz2)
  with executable permissions?

* Should we compress executable files at all?
  (Example scripts are usually very small.)

* Should we remove the executable permission of example scripts
  anyway, because the user should not execute it directly, but
  rather see it as example? The user reads it, copies and modifies
  it and then sets the +x.


I am interested in your comments and wish you a nice Sunday.

-- 
Best,
Jonas


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too?
  2017-06-18 11:41 [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too? Jonas Stein
@ 2017-06-18 17:16 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2017-06-18 17:16 UTC (permalink / raw)
  To: gentoo-dev

On Sun, 18 Jun 2017 13:41:17 +0200
Jonas Stein <jstein@gentoo.org> wrote:

> Dear all,
> 
> if we compress an executable script
> hello.sh
> with bzip2 or gzip the result is a file
> hello.sh.bz2 or hello.sh.gz
> with executable permissions. However it is not executable, of course.
> 
> ./hello.sh.bz2
> "cannot execute binary file: Exec format error"
> 
> One can not blame bzip2 for it, because it is exactly what its man
> page writes:
> "Each compressed file has the same modification date, permissions,
> and, when possible, ownership as the corresponding original, so that
> these properties can be correctly restored at decompression time."
> 
> On gentoo systems we can find many archives with with executable bit
> by running
> 
> $ find /usr/share/doc/ -executable -type f
> 
> 
> * Is it proper to install compressed archives (.zip, .gz, .bz2)
>   with executable permissions?
> 
> * Should we compress executable files at all?
>   (Example scripts are usually very small.)
> 
> * Should we remove the executable permission of example scripts
>   anyway, because the user should not execute it directly, but
>   rather see it as example? The user reads it, copies and modifies
>   it and then sets the +x.
> 
> 
> I am interested in your comments and wish you a nice Sunday.
> 

yeah, makes sense to drop +x, it is better to look at the examples
before running them blindly.

-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-18 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-18 11:41 [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too? Jonas Stein
2017-06-18 17:16 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox