Gentoo Archives: gentoo-dev

From: Jonas Stein <jstein@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too?
Date: Sun, 18 Jun 2017 11:41:31
Dear all,

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

"cannot execute binary file: Exec format error"

One can not blame bzip2 for it, because it is exactly what its man page
"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

$ 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.