Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 801535

Summary: sys-apps/busybox: /usr/share/udhcp/default.script contains postfix increment operator
Product: Gentoo Linux Reporter: kfm
Component: Current packagesAssignee: Embedded Gentoo Team <embedded>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 526268    

Description kfm 2021-07-11 08:27:08 UTC
Line #52 of /usr/share/udhcpc/default.script makes use of a postfix increment operator, which is not defined by POSIX and not supported by shells such as dash.

    $ sed -n 52p /usr/share/udhcpc/default.script
    route add default gw $i dev $interface metric $((metric++))

Considered in isolation, the matter could be resolved by writing it as follows.

    route add default gw $i dev $interface metric $metric
    : $(( metric += 1 ))

As an aside, the preceding seven lines look suspicious in so far as `ip route` is potentially invoked without testing whether ip(8) is available - which is inconsistent with the rest of the script - before going on to execute a seemingly equivalent route(8) command in that event.
Comment 1 Larry the Git Cow gentoo-dev 2022-06-30 21:41:03 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae3df10c876759010ceb65558932a31c1d72b831

commit ae3df10c876759010ceb65558932a31c1d72b831
Author:     Viorel Munteanu <ceamac.paragon@gmail.com>
AuthorDate: 2022-04-17 09:10:42 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-06-30 21:40:15 +0000

    sys-apps/busybox: Fix bashism in udhcpc script
    
    Closes: https://bugs.gentoo.org/801535
    Signed-off-by: Viorel Munteanu <ceamac.paragon@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/busybox/busybox-1.34.1-r1.ebuild | 1 +
 1 file changed, 1 insertion(+)