Bug#597580: [PATCH] copy_exec: use 'which' to find full path to executable.
Suggested patch is attached.
This would help to fix other bugs such as 852569.
From c16eddf70f92d1de9f77b4d39c00db329036ea1e Mon Sep 17 00:00:00 2001
From: Scott Moser <smoser@ubuntu.com>
Date: Tue, 26 Sep 2017 16:55:20 -0400
Subject: [PATCH] copy_exec: use 'which' to find full path to executable.
Add support in 'copy_exec' to not require a full path to the executable
that will be copied. This is related to #852569.
Debian: #597580
---
hook-functions | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/hook-functions b/hook-functions
index 5da0cde..02a4477 100644
--- a/hook-functions
+++ b/hook-functions
@@ -159,10 +159,15 @@ copy_file() {
# Location of the image dir is assumed to be $DESTDIR
# We never overwrite the target if it exists.
copy_exec() {
- local src target x nonoptlib ret
+ local osrc src target x nonoptlib ret
- src="${1}"
- target="${2:-$1}"
+ osrc="${1}"
+ if ! src=$(which "$osrc"); then
+ echo "Error: could not find path to '$osrc'"
+ return 2
+ fi
+
+ target="${2:-$src}"
copy_file binary "${src}" "${target}" || return $(($? - 1))
--
2.7.4
Reply to: