|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/5] xen/tools: remove usages of `stat -s` in check-endbr.sh
On Wed, Feb 11, 2026 at 02:07:13PM +0100, Jan Beulich wrote:
> On 11.02.2026 13:24, Roger Pau Monné wrote:
> > On Wed, Feb 11, 2026 at 12:40:58PM +0100, Jan Beulich wrote:
> >> On 11.02.2026 11:46, Roger Pau Monne wrote:
> >>> --- a/xen/tools/check-endbr.sh
> >>> +++ b/xen/tools/check-endbr.sh
> >>> @@ -92,14 +92,15 @@ ${OBJDUMP} -j .text $1 -d -w | grep ' endbr64 *$' |
> >>> cut -f 1 -d ':' > $VALID &
> >>> # check nevertheless.
> >>> #
> >>> eval $(${OBJDUMP} -j .text $1 -h |
> >>> - $AWK '$2 == ".text" {printf "vma_hi=%s\nvma_lo=%s\n", substr($4, 1,
> >>> 9), substr($4, 10, 16)}')
> >>> + $AWK '$2 == ".text" {printf "bin_sz=%s\nvma_hi=%s\nvma_lo=%s\n",
> >>> "0x" $3, substr($4, 1, 9), substr($4, 10, 16)}')
> >>>
> >>> -${OBJCOPY} -j .text $1 -O binary $TEXT_BIN
> >>> -
> >>> -bin_sz=$(stat -c '%s' $TEXT_BIN)
> >>> +# Convert objdump hex reported .text size to decimal
> >>> +bin_sz=$(printf %u $bin_sz)
> >>
> >> (Alternatively without this line, but ...
> >>
> >>> [ "$bin_sz" -ge $(((1 << 28) - $vma_lo)) ] &&
> >>
> >> [ "$(($bin_sz))" -ge $(((1 << 28) - $vma_lo)) ] &&
> >>
> >> ?)
> >
> > Isn't that bash-specific functionality? The script interpreter is set
> > as /bin/sh.
>
> I, too, would have thought so, but then the rhs of the -ge already used
> $((...)).
OK, yes, I didn't realize those existing usages. Now that I look at
it it does seem to have a bunch of other bashisms, for example
parameter expansion.
I will adjust that plus the commit message and take your RB.
Thanks, Roger.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |