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
1 Dear all,
2
3 if we compress an executable script
4 hello.sh
5 with bzip2 or gzip the result is a file
6 hello.sh.bz2 or hello.sh.gz
7 with executable permissions. However it is not executable, of course.
8
9 ./hello.sh.bz2
10 "cannot execute binary file: Exec format error"
11
12 One can not blame bzip2 for it, because it is exactly what its man page
13 writes:
14 "Each compressed file has the same modification date, permissions, and,
15 when possible, ownership as the corresponding original, so that these
16 properties can be correctly restored at decompression time."
17
18 On gentoo systems we can find many archives with with executable bit by
19 running
20
21 $ find /usr/share/doc/ -executable -type f
22
23
24 * Is it proper to install compressed archives (.zip, .gz, .bz2)
25 with executable permissions?
26
27 * Should we compress executable files at all?
28 (Example scripts are usually very small.)
29
30 * Should we remove the executable permission of example scripts
31 anyway, because the user should not execute it directly, but
32 rather see it as example? The user reads it, copies and modifies
33 it and then sets the +x.
34
35
36 I am interested in your comments and wish you a nice Sunday.
37
38 --
39 Best,
40 Jonas

Replies