On Fri, 08 Oct 2021 at 15:12:58 +0000, Thorsten Glaser wrote:
>>, so I completed your patch with 2373709bb461a71a7af46e7e9c59355fce63e52e.
> 
> -blkid="$(/sbin/blkid -o value -s TYPE -p ${offset:+-O "$offset"} -- "$dev")"
> +blkid="$(/sbin/blkid -o value -s TYPE -p ${offset:+-O "$((offset*512))"} -- 
> "$dev")"
> 
> That’s only good for offset ≤ 4194303 though and invokes C “Undefined
> Behaviour” on larger values. (More on LP64 of course.)

Ah right, thanks.  Given #-1 is a 12 years old bug and AFAICT you're the
first to report it I suppose nobody uses large offset= values.  Don't
think adding ‘Depends: bc’ is justified here :-P.

Also in practice I was able to use offset=2⁵⁹ with bash, dash, klibc's
sh and busybox's sh on a stock 32 bytes platform, so I'll just ignore
the potential overflow.  I'll just make the script choke when the
arithmetic operation fails.

-- 
Guilhem.

Attachment: signature.asc
Description: PGP signature

Reply via email to