docker-vackup icon indicating copy to clipboard operation
docker-vackup copied to clipboard

Don't use Bash case fallthrough

Open Guiorgy opened this issue 1 year ago • 4 comments

The feature was added in Bash 4.0, however, according to @markaltmann, some Mac systems still use Bash 3.x

The feature was used only for expressiveness, the line using it is completely optional (since the case it falls through to is *, aka a catch all), thus it can be safely removed without changing the logic.

Guiorgy avatar Nov 21 '24 11:11 Guiorgy

More on that, all macos systems use this old bundled Bash from 2007.

Reason is apparently licensing issues with the DRM in Apples app store.

Version 3.2.57 was the last under GPL-2.

I have also now opted to another bash package and not use the bundled one, then you are with 5.2.

IMHO a shitty decision by Apple. The same is true for many bundled software like python or ruby.

markaltmann avatar Nov 21 '24 11:11 markaltmann

@markaltmann Holy ****!

Guiorgy avatar Nov 21 '24 12:11 Guiorgy

Would it be better to shift to just supporting sh, which AFAIK every OS but iOS and Windows has 😛 ?

Thanks for the all the work, I'm still catching up after KubeCon and now enjoying Thanksgiving in the US, so I hope to get to the PR reviewing in the next few weeks 🤜🤛

BretFisher avatar Nov 27 '24 23:11 BretFisher

Would it be better to shift to just supporting sh, which AFAIK every OS but iOS and Windows has 😛 ?

Honestly, that has a few of it's own set of gachas:

  • According to this Ubuntu wiki page, $LINENO is not supported in dash, the default sh in Ubuntu. Though, the page is from 2017, so I don't know how accurate the statement is today, however, it remains that on older Ubuntu systems it might not work.
  • The pipefail option in set -Eeo pipefail is Bashism, so that would have to go, potentially having unforeseen consequences? EDIT: As of POSIX 2024 pipefail is part of POSIX, though considering we are still discussing whether Bash 4.x is supported widely enough, I don't know when that will become universal.

The case fallthrough is Bashism (>v4.0) so it will have to be removed if we switch to POSIX anyways.

From the top of my head, everything else seems to be POSIX compliant, so it might not be a bad choice.

Guiorgy avatar Nov 29 '24 13:11 Guiorgy