* [PATCH] livepatch-build-tools: fix misuse of script directory as work directory
@ 2023-12-13 13:51 Roger Pau Monne
2023-12-13 16:17 ` Ross Lagerwall
2023-12-14 8:19 ` Jan Beulich
0 siblings, 2 replies; 4+ messages in thread
From: Roger Pau Monne @ 2023-12-13 13:51 UTC (permalink / raw)
To: xen-devel; +Cc: Konrad Rzeszutek Wilk, Ross Lagerwall, Roger Pau Monne
It's incorrect to assume that the script directory will always match the
directory the script is executed from. Instead cache the directory at the
start of script execution in order to be able to get back to it if needed.
Fixes: 629ab8ddb775 ('livepatch-build-tools: do not use readlink -m option')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
livepatch-build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/livepatch-build b/livepatch-build
index f622683fc56c..e318cecd4da6 100755
--- a/livepatch-build
+++ b/livepatch-build
@@ -25,6 +25,7 @@
# script.
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
+WORKDIR="$(readlink -f -- .)"
CPUS="$(getconf _NPROCESSORS_ONLN)"
DEBUG=n
XEN_DEBUG=n
@@ -459,7 +460,7 @@ if [ "${SKIP}" != "build" ]; then
fi
if [ "${SKIP}" != "diff" ]; then
- cd "${SCRIPTDIR}" || die
+ cd "${WORKDIR}" || die
[ -d "$outputarg" ] || die "Output directory does not exist"
OUTPUT="$(readlink -f -- "$outputarg")"
base-commit: 0ed8ef88dc300750696a64e89efa3b82502f6dc7
prerequisite-patch-id: 20327fdf775db3903c8067a0642254d67c495806
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] livepatch-build-tools: fix misuse of script directory as work directory
2023-12-13 13:51 [PATCH] livepatch-build-tools: fix misuse of script directory as work directory Roger Pau Monne
@ 2023-12-13 16:17 ` Ross Lagerwall
2023-12-14 8:19 ` Jan Beulich
1 sibling, 0 replies; 4+ messages in thread
From: Ross Lagerwall @ 2023-12-13 16:17 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: xen-devel, Konrad Rzeszutek Wilk
On Wed, Dec 13, 2023 at 1:52 PM Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> It's incorrect to assume that the script directory will always match the
> directory the script is executed from. Instead cache the directory at the
> start of script execution in order to be able to get back to it if needed.
>
> Fixes: 629ab8ddb775 ('livepatch-build-tools: do not use readlink -m option')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> livepatch-build | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/livepatch-build b/livepatch-build
> index f622683fc56c..e318cecd4da6 100755
> --- a/livepatch-build
> +++ b/livepatch-build
> @@ -25,6 +25,7 @@
> # script.
>
> SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
> +WORKDIR="$(readlink -f -- .)"
> CPUS="$(getconf _NPROCESSORS_ONLN)"
> DEBUG=n
> XEN_DEBUG=n
> @@ -459,7 +460,7 @@ if [ "${SKIP}" != "build" ]; then
> fi
>
> if [ "${SKIP}" != "diff" ]; then
> - cd "${SCRIPTDIR}" || die
> + cd "${WORKDIR}" || die
> [ -d "$outputarg" ] || die "Output directory does not exist"
> OUTPUT="$(readlink -f -- "$outputarg")"
>
>
> base-commit: 0ed8ef88dc300750696a64e89efa3b82502f6dc7
> prerequisite-patch-id: 20327fdf775db3903c8067a0642254d67c495806
> --
> 2.43.0
>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Thanks,
Ross
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] livepatch-build-tools: fix misuse of script directory as work directory
2023-12-13 13:51 [PATCH] livepatch-build-tools: fix misuse of script directory as work directory Roger Pau Monne
2023-12-13 16:17 ` Ross Lagerwall
@ 2023-12-14 8:19 ` Jan Beulich
2023-12-14 8:49 ` Roger Pau Monné
1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2023-12-14 8:19 UTC (permalink / raw)
To: Roger Pau Monne; +Cc: Konrad Rzeszutek Wilk, Ross Lagerwall, xen-devel
On 13.12.2023 14:51, Roger Pau Monne wrote:
> --- a/livepatch-build
> +++ b/livepatch-build
> @@ -25,6 +25,7 @@
> # script.
>
> SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
> +WORKDIR="$(readlink -f -- .)"
More for my own education than anything else: Isn't the (standard) pwd
utility intended to be the "canonical" way of getting at the current
directory? Its -P option (apparently what would be needed to match the
-f used above) is also a standard one afaict.
Jan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] livepatch-build-tools: fix misuse of script directory as work directory
2023-12-14 8:19 ` Jan Beulich
@ 2023-12-14 8:49 ` Roger Pau Monné
0 siblings, 0 replies; 4+ messages in thread
From: Roger Pau Monné @ 2023-12-14 8:49 UTC (permalink / raw)
To: Jan Beulich; +Cc: Konrad Rzeszutek Wilk, Ross Lagerwall, xen-devel
On Thu, Dec 14, 2023 at 09:19:35AM +0100, Jan Beulich wrote:
> On 13.12.2023 14:51, Roger Pau Monne wrote:
> > --- a/livepatch-build
> > +++ b/livepatch-build
> > @@ -25,6 +25,7 @@
> > # script.
> >
> > SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
> > +WORKDIR="$(readlink -f -- .)"
>
> More for my own education than anything else: Isn't the (standard) pwd
> utility intended to be the "canonical" way of getting at the current
> directory? Its -P option (apparently what would be needed to match the
> -f used above) is also a standard one afaict.
Hm, yes, having looked at it `pwd -P` would also be fine. I've used
readlink because that's what is used thorough the script.
Thanks, Roger.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-14 8:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-13 13:51 [PATCH] livepatch-build-tools: fix misuse of script directory as work directory Roger Pau Monne
2023-12-13 16:17 ` Ross Lagerwall
2023-12-14 8:19 ` Jan Beulich
2023-12-14 8:49 ` Roger Pau Monné
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.