Message ID | 20190408083224.104802-3-wipawel@amazon.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [livepatch-build-tools,1/4] livepatch-gcc: Allow toolchain command with versions | expand |
On 4/8/19 9:32 AM, Pawel Wieczorkiewicz wrote: > In some build systems symlinks might be used for patch file names > to point from target directories to actual patches. Following those > symlinks breaks naming convention as the resulting built modules > would be named after the actual hardlink insteads of the symlink. > > Livepatch-build obtains hotpatch name from the patch file, so it > should not canonicalize the file path resolving all the symlinks to > not lose the original symlink name. > > Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de> > Reviewed-by: Martin Pohlack <mpohlack@amazon.de> > Reviewed-by: Bjoern Doebel <doebel@amazon.de> > Reviewed-by: Norbert Manthey <nmanthey@amazon.de> > --- > livepatch-build | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/livepatch-build b/livepatch-build > index c057fa1..796838c 100755 > --- a/livepatch-build > +++ b/livepatch-build > @@ -265,7 +265,9 @@ done > [ -z "$DEPENDS" ] && die "Build-id dependency not given" > > SRCDIR="$(readlink -m -- "$srcarg")" > -PATCHFILE="$(readlink -m -- "$patcharg")" > +# We need an absolute path because we move around, but we need to > +# retain the name of the symlink (= realpath -s) > +PATCHFILE="$(readlink -f "$(dirname "$patcharg")")/$(basename "$patcharg")" > CONFIGFILE="$(readlink -m -- "$configarg")" > OUTPUT="$(readlink -m -- "$outputarg")" > > This works, but would it not be simpler to just pass $patcharg into make_patch_name()?
> On 29. Apr 2019, at 14:40, Ross Lagerwall <ross.lagerwall@citrix.com> wrote: > > On 4/8/19 9:32 AM, Pawel Wieczorkiewicz wrote: >> In some build systems symlinks might be used for patch file names >> to point from target directories to actual patches. Following those >> symlinks breaks naming convention as the resulting built modules >> would be named after the actual hardlink insteads of the symlink. >> Livepatch-build obtains hotpatch name from the patch file, so it >> should not canonicalize the file path resolving all the symlinks to >> not lose the original symlink name. >> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de> >> Reviewed-by: Martin Pohlack <mpohlack@amazon.de> >> Reviewed-by: Bjoern Doebel <doebel@amazon.de> >> Reviewed-by: Norbert Manthey <nmanthey@amazon.de> >> --- >> livepatch-build | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> diff --git a/livepatch-build b/livepatch-build >> index c057fa1..796838c 100755 >> --- a/livepatch-build >> +++ b/livepatch-build >> @@ -265,7 +265,9 @@ done >> [ -z "$DEPENDS" ] && die "Build-id dependency not given" >> SRCDIR="$(readlink -m -- "$srcarg")" >> -PATCHFILE="$(readlink -m -- "$patcharg")" >> +# We need an absolute path because we move around, but we need to >> +# retain the name of the symlink (= realpath -s) >> +PATCHFILE="$(readlink -f "$(dirname "$patcharg")")/$(basename "$patcharg")" >> CONFIGFILE="$(readlink -m -- "$configarg")" >> OUTPUT="$(readlink -m -- "$outputarg")" >> > > This works, but would it not be simpler to just pass $patcharg into make_patch_name()? > No strong opinion here, but the readlink change felt less invasive (no changes to the existing semantics). Thank you for looking into this. > -- > Ross Lagerwall > Best Regards, Pawel Wieczorkiewicz Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich Ust-ID: DE 289 237 879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
On 4/29/19 4:24 PM, Wieczorkiewicz, Pawel wrote: > >> On 29. Apr 2019, at 14:40, Ross Lagerwall <ross.lagerwall@citrix.com> wrote: >> >> On 4/8/19 9:32 AM, Pawel Wieczorkiewicz wrote: >>> In some build systems symlinks might be used for patch file names >>> to point from target directories to actual patches. Following those >>> symlinks breaks naming convention as the resulting built modules >>> would be named after the actual hardlink insteads of the symlink. >>> Livepatch-build obtains hotpatch name from the patch file, so it >>> should not canonicalize the file path resolving all the symlinks to >>> not lose the original symlink name. >>> Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de> >>> Reviewed-by: Martin Pohlack <mpohlack@amazon.de> >>> Reviewed-by: Bjoern Doebel <doebel@amazon.de> >>> Reviewed-by: Norbert Manthey <nmanthey@amazon.de> >>> --- >>> livepatch-build | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> diff --git a/livepatch-build b/livepatch-build >>> index c057fa1..796838c 100755 >>> --- a/livepatch-build >>> +++ b/livepatch-build >>> @@ -265,7 +265,9 @@ done >>> [ -z "$DEPENDS" ] && die "Build-id dependency not given" >>> SRCDIR="$(readlink -m -- "$srcarg")" >>> -PATCHFILE="$(readlink -m -- "$patcharg")" >>> +# We need an absolute path because we move around, but we need to >>> +# retain the name of the symlink (= realpath -s) >>> +PATCHFILE="$(readlink -f "$(dirname "$patcharg")")/$(basename "$patcharg")" >>> CONFIGFILE="$(readlink -m -- "$configarg")" >>> OUTPUT="$(readlink -m -- "$outputarg")" >>> >> >> This works, but would it not be simpler to just pass $patcharg into make_patch_name()? >> > > No strong opinion here, but the readlink change felt less invasive (no changes to the existing semantics). > > Thank you for looking into this. > OK, that's fine then. Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
diff --git a/livepatch-build b/livepatch-build index c057fa1..796838c 100755 --- a/livepatch-build +++ b/livepatch-build @@ -265,7 +265,9 @@ done [ -z "$DEPENDS" ] && die "Build-id dependency not given" SRCDIR="$(readlink -m -- "$srcarg")" -PATCHFILE="$(readlink -m -- "$patcharg")" +# We need an absolute path because we move around, but we need to +# retain the name of the symlink (= realpath -s) +PATCHFILE="$(readlink -f "$(dirname "$patcharg")")/$(basename "$patcharg")" CONFIGFILE="$(readlink -m -- "$configarg")" OUTPUT="$(readlink -m -- "$outputarg")"