Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/eselect:master commit in: libs/, /
Date: Wed, 01 Jun 2016 19:43:24
Message-Id: 1464810071.da9a451824ccd5e4e2b9be405fecad82599ba702.ulm@gentoo
1 commit: da9a451824ccd5e4e2b9be405fecad82599ba702
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 1 19:41:11 2016 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 1 19:41:11 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=da9a4518
7
8 Avoid absolute paths for programs.
9
10 * configure.ac: Where possible, use AC_CHECK_PROGS instead of
11 AC_PATH_PROGS, in order to avoid absolute paths, bug 122260.
12 * libs/core.bash.in (sed):
13 * libs/package-manager.bash.in (portageq): Invoke commands with
14 "command" so that they will work without a path.
15
16 ChangeLog | 8 ++++++++
17 configure.ac | 31 +++++++++++++------------------
18 libs/core.bash.in | 4 ++--
19 libs/package-manager.bash.in | 4 ++--
20 4 files changed, 25 insertions(+), 22 deletions(-)
21
22 diff --git a/ChangeLog b/ChangeLog
23 index 5bb2855..c166ad0 100644
24 --- a/ChangeLog
25 +++ b/ChangeLog
26 @@ -1,3 +1,11 @@
27 +2016-06-01 Ulrich Müller <ulm@g.o>
28 +
29 + * configure.ac: Where possible, use AC_CHECK_PROGS instead of
30 + AC_PATH_PROGS, in order to avoid absolute paths, bug 122260.
31 + * libs/core.bash.in (sed):
32 + * libs/package-manager.bash.in (portageq): Invoke commands with
33 + "command" so that they will work without a path.
34 +
35 2016-01-27 Ulrich Müller <ulm@g.o>
36
37 * bin/eselect.in: Set umask +rx, bug 572348.
38
39 diff --git a/configure.ac b/configure.ac
40 index 8f38759..6fce662 100644
41 --- a/configure.ac
42 +++ b/configure.ac
43 @@ -19,7 +19,7 @@ fi
44
45 # AC_PROG_SED doesn't work here, because on Gentoo FreeBSD systems it
46 # is confused by a wrapper script that is in the PATH at build time.
47 -AC_PATH_PROGS(SED, [gsed sed])
48 +AC_CHECK_PROGS(SED, [gsed sed])
49 if test x$SED = x; then
50 AC_MSG_ERROR([sed is required])
51 fi
52 @@ -31,27 +31,22 @@ else
53 AC_MSG_ERROR([GNU sed is required])
54 fi
55
56 -AC_PATH_PROG(PORTAGEQ, portageq, /usr/bin/portageq,
57 - [$prefix/bin:/usr/bin:/bin:$PATH])
58 AC_PATH_PROG(ENV_UPDATE, env-update, /usr/sbin/env-update,
59 [$PATH:$prefix/sbin:/usr/sbin])
60
61 -AC_PATH_PROG(READLINK, greadlink)
62 -if test x$READLINK = x; then
63 - AC_PATH_PROG(READLINK, readlink)
64 - if test x$READLINK != x; then
65 - AC_MSG_CHECKING([whether readlink supports -f])
66 - if $READLINK -f . >/dev/null 2>&1; then
67 - AC_MSG_RESULT(yes)
68 - else
69 - AC_MSG_RESULT(no)
70 - READLINK=""
71 - fi
72 - fi
73 - if test x$READLINK = x; then
74 - AC_PATH_PROG(REALPATH, realpath)
75 +AC_CHECK_PROGS(READLINK, [greadlink readlink])
76 +if test x$READLINK != x; then
77 + AC_MSG_CHECKING([whether $READLINK supports -f])
78 + if $READLINK -f . >/dev/null 2>&1; then
79 + AC_MSG_RESULT(yes)
80 + else
81 + AC_MSG_RESULT(no)
82 + READLINK=""
83 fi
84 fi
85 +if test x$READLINK = x; then
86 + AC_CHECK_PROGS(REALPATH, realpath)
87 +fi
88 if test x$READLINK != x; then
89 CANONICALISE="$READLINK -f"
90 elif test x$REALPATH != x; then
91 @@ -63,7 +58,7 @@ AC_SUBST(CANONICALISE)
92
93 # Gentoo uses rst2html.py but most other
94 # distros install it w/o the .py extension
95 -AC_PATH_PROGS(RST2HTML, [rst2html rst2html.py])
96 +AC_CHECK_PROGS(RST2HTML, [rst2html rst2html.py])
97
98 # Support for Gentoo Prefix
99 AC_MSG_CHECKING([if target installation is in an offset prefix])
100
101 diff --git a/libs/core.bash.in b/libs/core.bash.in
102 index 6b6f049..baddfde 100644
103 --- a/libs/core.bash.in
104 +++ b/libs/core.bash.in
105 @@ -119,7 +119,7 @@ inherit() {
106 done
107 }
108
109 -# GNU sed wrapper (real path to GNU sed determined by configure)
110 +# GNU sed wrapper (sed or gsed, as determined by configure)
111 sed() {
112 - @SED@ "$@"
113 + command @SED@ "$@"
114 }
115
116 diff --git a/libs/package-manager.bash.in b/libs/package-manager.bash.in
117 index 691bd3c..b6d8218 100644
118 --- a/libs/package-manager.bash.in
119 +++ b/libs/package-manager.bash.in
120 @@ -28,9 +28,9 @@ package_manager() {
121 }
122
123 # portageq
124 -# Run portageq with safe filename as set by configure. Redirect stderr
125 +# Run portageq. Redirect stderr
126 portageq() {
127 - @PORTAGEQ@ "$@" 2>/dev/null
128 + command portageq "$@" 2>/dev/null
129 }
130
131 # run_paludis PRIVATE