<blockquote>
<p>Suggest making the same change in other locations where shell echo is used to sum hex variables?</p>
</blockquote>
<p>Yes. If we precede all hex values by "0x" we ensure that no command can interpret that as decimal. Also, it makes 100% sense that summing hex gives back hex.</p>
<p>Running <code>git grep '$((.*+.*))'</code> gives:</p>
<pre><code>boards/esp32-olimex-evb/Makefile.include:        $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
cpu/esp32/Makefile.dep:    $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
cpu/esp32/Makefile.dep:    $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
cpu/esp8266/Makefile.include:    $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
dist/tools/openocd/openocd.sh:        IMAGE_OFFSET=$(printf "0x%08x\n" "$((${IMAGE_OFFSET} + ${FLASH_ADDR}))")
makefiles/boot/riotboot.mk:export SLOT1_OFFSET ?= $(shell echo $$(($(SLOT0_OFFSET) + $(SLOT0_LEN))))
makefiles/boot/riotboot.mk:SLOT0_IMAGE_OFFSET := $$(($(SLOT0_OFFSET) + $(RIOTBOOT_HDR_LEN)))
makefiles/boot/riotboot.mk:SLOT1_IMAGE_OFFSET := $$(($(SLOT1_OFFSET) + $(RIOTBOOT_HDR_LEN)))
makefiles/boot/riotboot.mk:     $(Q)$(HEADER_TOOL) generate $< $(APP_VER) $$(($(ROM_START_ADDR)+$(OFFSET))) $(RIOTBOOT_HDR_LEN) - $
makefiles/boot/riotboot.mk:     $(Q)truncate -s $$(($(SLOT0_OFFSET) + $(SLOT0_LEN) + $(RIOTBOOT_HDR_LEN))) $@.tmp
makefiles/info-nproc.inc.mk:    NPROC := $(shell echo $$(($(NPROC) + 1)))
makefiles/mcuboot.mk:   $(Q)$(_LINK) $(LINKFLAGPREFIX)--defsym=offset="$$(($(MCUBOOT_SLOT0_SIZE) + $(IMAGE_HDR_SIZE)))" \
tests/cortexm_common_ldscript/Makefile: EXPECT_START_ADDR=$$(printf "0x%08x" $$(( $(ROM_START_ADDR) + $* ))); \
tests/cortexm_common_ldscript/Makefile:test-assert_overflow_too_big_for_rom: FW_ROM_LEN=$$(($(ROM_LEN_BYTES) + 1))
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/11201#issuecomment-474293854">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AEn7YEosOzmwHLfQnI_l3gPpXs5Bag2Sks5vYLxLgaJpZM4b5fT5">mute the thread</a>.<img src="https://github.com/notifications/beacon/AEn7YOxNeaYE5ueGj_X33nuyOAsBFmNxks5vYLxLgaJpZM4b5fT5.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/RIOT-OS/RIOT","title":"RIOT-OS/RIOT","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/RIOT-OS/RIOT"}},"updates":{"snippets":[{"icon":"PERSON","message":"@jcarrano in #11201: \u003e Suggest making the same change in other locations where shell echo is used to sum hex variables?\r\n\r\nYes. If we precede all hex values by \"0x\" we ensure that no command can interpret that as decimal. Also, it makes 100% sense that summing hex gives back hex.\r\n\r\nRunning `git grep '$((.*+.*))'` gives:\r\n\r\n```\r\nboards/esp32-olimex-evb/Makefile.include:        $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))\r\ncpu/esp32/Makefile.dep:    $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))\r\ncpu/esp32/Makefile.dep:    $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))\r\ncpu/esp8266/Makefile.include:    $(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))\r\ndist/tools/openocd/openocd.sh:        IMAGE_OFFSET=$(printf \"0x%08x\\n\" \"$((${IMAGE_OFFSET} + ${FLASH_ADDR}))\")\r\nmakefiles/boot/riotboot.mk:export SLOT1_OFFSET ?= $(shell echo $$(($(SLOT0_OFFSET) + $(SLOT0_LEN))))\r\nmakefiles/boot/riotboot.mk:SLOT0_IMAGE_OFFSET := $$(($(SLOT0_OFFSET) + $(RIOTBOOT_HDR_LEN)))\r\nmakefiles/boot/riotboot.mk:SLOT1_IMAGE_OFFSET := $$(($(SLOT1_OFFSET) + $(RIOTBOOT_HDR_LEN)))\r\nmakefiles/boot/riotboot.mk:     $(Q)$(HEADER_TOOL) generate $\u003c $(APP_VER) $$(($(ROM_START_ADDR)+$(OFFSET))) $(RIOTBOOT_HDR_LEN) - $\r\nmakefiles/boot/riotboot.mk:     $(Q)truncate -s $$(($(SLOT0_OFFSET) + $(SLOT0_LEN) + $(RIOTBOOT_HDR_LEN))) $@.tmp\r\nmakefiles/info-nproc.inc.mk:    NPROC := $(shell echo $$(($(NPROC) + 1)))\r\nmakefiles/mcuboot.mk:   $(Q)$(_LINK) $(LINKFLAGPREFIX)--defsym=offset=\"$$(($(MCUBOOT_SLOT0_SIZE) + $(IMAGE_HDR_SIZE)))\" \\\r\ntests/cortexm_common_ldscript/Makefile: EXPECT_START_ADDR=$$(printf \"0x%08x\" $$(( $(ROM_START_ADDR) + $* ))); \\\r\ntests/cortexm_common_ldscript/Makefile:test-assert_overflow_too_big_for_rom: FW_ROM_LEN=$$(($(ROM_LEN_BYTES) + 1))\r\n```"}],"action":{"name":"View Pull Request","url":"https://github.com/RIOT-OS/RIOT/pull/11201#issuecomment-474293854"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/11201#issuecomment-474293854",
"url": "https://github.com/RIOT-OS/RIOT/pull/11201#issuecomment-474293854",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>