1 |
commit: a90bafde1cab2db1f4d6fc65e7bf1b66df680449 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 23 08:18:20 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 17 18:16:33 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a90bafde |
7 |
|
8 |
f{owners,perms}: Warn when using relative path |
9 |
|
10 |
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org> |
11 |
Closes: https://github.com/gentoo/portage/pull/364 |
12 |
|
13 |
bin/ebuild-helpers/fowners | 15 +++++++++++++++ |
14 |
bin/ebuild-helpers/fperms | 15 +++++++++++++++ |
15 |
2 files changed, 30 insertions(+) |
16 |
|
17 |
diff --git a/bin/ebuild-helpers/fowners b/bin/ebuild-helpers/fowners |
18 |
index 68004210b..0eda73e58 100755 |
19 |
--- a/bin/ebuild-helpers/fowners |
20 |
+++ b/bin/ebuild-helpers/fowners |
21 |
@@ -8,6 +8,21 @@ if ! ___eapi_has_prefix_variables; then |
22 |
EPREFIX= ED=${D} |
23 |
fi |
24 |
|
25 |
+got_owner= |
26 |
+for arg; do |
27 |
+ [[ ${arg} == -* ]] && continue |
28 |
+ if [[ ! ${got_owner} ]]; then |
29 |
+ got_owner=1 |
30 |
+ continue |
31 |
+ fi |
32 |
+ if [[ ${arg} != /* ]]; then |
33 |
+ eqawarn "Relative path passed to '${0##*/}': ${arg}" |
34 |
+ eqawarn "This is unsupported. Please use 'chown' when you need to work on files" |
35 |
+ eqawarn "outside the installation image (\${ED})." |
36 |
+ fi |
37 |
+done |
38 |
+ |
39 |
+ |
40 |
# we can't prefix all arguments because |
41 |
# chown takes random options |
42 |
slash="/" |
43 |
|
44 |
diff --git a/bin/ebuild-helpers/fperms b/bin/ebuild-helpers/fperms |
45 |
index c63a6abc3..f98560039 100755 |
46 |
--- a/bin/ebuild-helpers/fperms |
47 |
+++ b/bin/ebuild-helpers/fperms |
48 |
@@ -8,6 +8,21 @@ if ! ___eapi_has_prefix_variables; then |
49 |
ED=${D} |
50 |
fi |
51 |
|
52 |
+got_mode= |
53 |
+for arg; do |
54 |
+ # - can either be an option or a mode string |
55 |
+ [[ ${arg} == -* && ${arg} != -[ugorwxXst] ]] && continue |
56 |
+ if [[ ! ${got_mode} ]]; then |
57 |
+ got_mode=1 |
58 |
+ continue |
59 |
+ fi |
60 |
+ if [[ ${arg} != /* ]]; then |
61 |
+ eqawarn "Relative path passed to '${0##*/}': ${arg}" |
62 |
+ eqawarn "This is unsupported. Please use 'chmod' when you need to work on files" |
63 |
+ eqawarn "outside the installation image (\${ED})." |
64 |
+ fi |
65 |
+done |
66 |
+ |
67 |
# we can't prefix all arguments because |
68 |
# chmod takes random options |
69 |
slash="/" |