Gentoo Archives: gentoo-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too?
Date: Sun, 18 Jun 2017 17:16:23
Message-Id: 20170618101613.6d88058a.dolsen@gentoo.org
In Reply to: [gentoo-dev] [RFC] Should the compressed archive of an executable file be executable too? by Jonas Stein
1 On Sun, 18 Jun 2017 13:41:17 +0200
2 Jonas Stein <jstein@g.o> wrote:
3
4 > Dear all,
5 >
6 > if we compress an executable script
7 > hello.sh
8 > with bzip2 or gzip the result is a file
9 > hello.sh.bz2 or hello.sh.gz
10 > with executable permissions. However it is not executable, of course.
11 >
12 > ./hello.sh.bz2
13 > "cannot execute binary file: Exec format error"
14 >
15 > One can not blame bzip2 for it, because it is exactly what its man
16 > page writes:
17 > "Each compressed file has the same modification date, permissions,
18 > and, when possible, ownership as the corresponding original, so that
19 > these properties can be correctly restored at decompression time."
20 >
21 > On gentoo systems we can find many archives with with executable bit
22 > by running
23 >
24 > $ find /usr/share/doc/ -executable -type f
25 >
26 >
27 > * Is it proper to install compressed archives (.zip, .gz, .bz2)
28 > with executable permissions?
29 >
30 > * Should we compress executable files at all?
31 > (Example scripts are usually very small.)
32 >
33 > * Should we remove the executable permission of example scripts
34 > anyway, because the user should not execute it directly, but
35 > rather see it as example? The user reads it, copies and modifies
36 > it and then sets the +x.
37 >
38 >
39 > I am interested in your comments and wish you a nice Sunday.
40 >
41
42 yeah, makes sense to drop +x, it is better to look at the examples
43 before running them blindly.
44
45 --
46 Brian Dolbec <dolsen>