Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove "bashish" code from our packages #715

Open
SvenRoederer opened this issue Jun 30, 2019 · 6 comments
Open

remove "bashish" code from our packages #715

SvenRoederer opened this issue Jun 30, 2019 · 6 comments

Comments

@SvenRoederer
Copy link
Contributor

SvenRoederer commented Jun 30, 2019

The recent changes of the migration-code added some bashism to it, e.g. freifunk-berlin/firmware-packages@7fcc523#diff-9dd2e51c1a5b793cf384a31152376f36R403 .

We are using busybox-ash, which officially don't support "==" syntax, see expr-section of https://busybox.net/downloads/BusyBox.html. This should be changed to correct syntax, as was also done for OpenWrt once (openwrt/openwrt@d6ac8ca)

@SvenRoederer SvenRoederer changed the title fix "bashish fix "bashish" code in migration-script Jun 30, 2019
@SvenRoederer SvenRoederer added this to the Hedy-1.1.0 milestone Jun 30, 2019
@SvenRoederer
Copy link
Contributor Author

The syntax "[[" is also a bash-extension (https://stackoverflow.com/questions/669452/is-double-square-brackets-preferable-over-single-square-brackets-in-ba) not supported in ash. So scripts using this syntax will not work as expected.

works in BASH:

bash$ b="test 1234"
bash$ [[ "test 1234" = $b ]] && echo strings are equal
strings are equal

fails in Busybox/ASH:

ash$ b="test 1234"
ash$ [[ "test 1234" = $b ]] && echo strings are equal
-ash: 1234: unknown operand

SvenRoederer added a commit to freifunk-berlin/firmware-packages that referenced this issue Dec 28, 2019
"[[" is a bash-extension to POSIX not fully supported by ash. See issue
freifunk-berlin/firmware#715.
@SvenRoederer
Copy link
Contributor Author

PR openwrt/openwrt#2647 tries to remove some bashism in OpenWrt

@Akira25
Copy link
Member

Akira25 commented Apr 20, 2020

The reason for this issue remains open is the unmerged upstream commit to OpenWRT, right?

@SvenRoederer
Copy link
Contributor Author

Most of the referenced upstream commits have been merged already on 2020-01-26. The last one I just checked and resubmitted again. I assume it will be merged soon.
@Akira25 thanks for the ping.

But I think our repo still contains the bashism ...

@Akira25
Copy link
Member

Akira25 commented Apr 20, 2020

I did some grep-stuff on recent checkouts of the firmware and the firmware-packages-repo. There where matches in the packages repo only:

grep -rl "\[\[" . | grep .sh

./utils/freifunk-berlin-migration/uci-defaults/freifunk-berlin-01-migration.sh
./utils/freifunk-berlin-migration/files/lib/functions/semver.sh

grep -rl "==" . | grep .sh

./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/30-batman-adv.sh
./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/20-network.sh
./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/30-olsrd.sh   
./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/15-wireless.sh
./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/60-dhcp.sh   
./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/25-tunnels.sh
./utils/freifunk-berlin-wizard-backend/files/usr/lib/ffwizard.d/30-olsrd2.sh  
./utils/freifunk-berlin-migration/uci-defaults/freifunk-berlin-01-migration.sh
./utils/freifunk-berlin-migration/files/lib/functions/semver.sh
./utils/luci-app-ffwizard-berlin/luasrc/model/cbi/freifunk/assistent/shareInternet.lua
./addons/freifunk-berlin-lib-guard/files/lib/functions/guard.sh
./addons/freifunk-berlin-configtools/root/usr/share/freifunk-berlin/bandwidth-change.sh
./addons/freifunk-berlin-configtools/root/usr/share/freifunk-berlin/sharenet-switch.sh

In the firmware-repo matches only did happen in patch files. But i assume, that they are fine, as the build environment uses bash, right?

@SvenRoederer
Copy link
Contributor Author

SvenRoederer commented Apr 20, 2020

Correct host-commands of the build-scripts are executed by the host-bash. But the packages-code will run on the OpenWrt-Router with ash.
Let's forget about the "freifunk-berlin-wizard" as this code is deprecated and nobody maintaining it (#746).

@znrR znrR added this to Backlog (wishes for discussion) in Freifunk Berlin Firmware Meetings Apr 21, 2020
@znrR znrR moved this from Backlog (wishes for discussion) to Backlog (Blockers for release) in Freifunk Berlin Firmware Meetings Apr 21, 2020
@pmelange pmelange removed their assignment Apr 21, 2020
@SvenRoederer SvenRoederer changed the title fix "bashish" code in migration-script remove "bashish" code from our packages Apr 21, 2020
@SvenRoederer SvenRoederer added this to To do in Release 2021.x May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Release 2021.x
  
To do
Freifunk Berlin Firmware Meetings
  
Backlog (Blockers for next Major-rele...
Development

No branches or pull requests

3 participants