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
Message-Id: ba64d157-cd8c-67a5-6799-c13f41b99437@gentoo.org
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

Replies