This is kind of a rant, but mostly a plea.

There are times when BusyBox is the only tool you can use. You’ve got some embedded device with 32k RAM or something; I get it. It’s the right tool. But please, please, In begging you: don’t use it just because you’re lazy.

I find BusyBox used in places where it’s not necessary. There’s enough RAM, there’s more than enough storage, and yet, it’s got BusyBox.

BusyBox tooling is absolutely aenemic. Simple things, common things, like - oh, - capturing a regexp group from a simple match are practically impossible. But you can do this in bash; heck, it’s built in! But BusyBox uses ash, which is barely a shell and certainly doesn’t support regexp matching with group capture. Maybe awk? Well, gawk lets you, with -oP, but of course BusyBox doesn’t use GNU awk, and so you can’t get at the capture groups because it doesn’t support perl REs. It’d be shocking if BusyBox provided any truly capable tools like ripgrep, in which this would be trivial. I haven’t tried BB’s sed yet, because sed’s RE escaping is and has always been a bizarre nightmarish Frankenstein syntax, but I’ve got a dime riding on some restriction in BB’s sed that prevents getting at capture groups there, too.

BusyBox serves a purpose; it is intentionally barely functional; size constraining trumps all other considerations. It achieves this well. My issue isn’t with BusyBox, it’s with people using it everywhere when they don’t need to, making life hell for anyone who’s trying to actually get any work done in it.

So please. For the sanity of your users: don’t reach for BusyBox just because it’s easy, or because you’re tickled that you’re going to save a megabyte or two; please spare a thought for your users on which you are inflicting these constraints. Use it when you have to, because otherwise it doesn’t fit. Otherwise, chose a real shell, at least bash, and include some tools capable of more than less than the bare minimum.

  • nickwitha_k (he/him)@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    10
    arrow-down
    1
    ·
    6 days ago

    There are certainly places where BusyBox makes a lot of sense. Could you give some examples of where you’re seeing it out of place?

    • I preface this with a statement that I’m brand-loyal to gliNet products. Love them to bits. I love that they’re based on OpenWRT, and that you can ssh into them. But their user space tooling stinks.

      They have 500MB RAM. My home router has a current uptime of 24 days, and half the RAM is still free. It’s hard to tell how much persistent storage is on the device, but there’s at least 50MB free. They could have put something a little more capable on it. It’s what I’m currently fighting with - I want to script it so my VPN exit node auto switches at random times to random nodes - and it’s just frustrating with the onboard tooling.

      This isn’t the first time I’ve run into it; it’s not frequent, but it’s happened more than once, and I think it’s just a sloppy, lazy decision someone made.

      • aport@programming.dev
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        5
        ·
        6 days ago

        If it’s OpenWrt then use Lua. You probably could have written a solution in the time it took you to come whine about BusyBox.

    • You know, I’ve never had a problem with Alpine. Maybe it’s that I’m choosing less minimal base images, but the tooling always seems sufficient, and adding extra packages is super easy. Or, maybe Alpine just builds a BusyBox with all the features turned on.

      I’m pretty sure when I’ve logged into my Alpine based containers, I get Bash and not Ash. That solves, like, 70% of the problems right there. grep doesn’t need to have good regexp support, because bash has it built-in.

      • pastermil@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        5
        ·
        6 days ago

        Alpine comes with busybox. Yes, I’m pretty sure they turn on all the good features.

        By the way, on which system you were using that not all the features are turned on?

  • palordrolap@kbin.run
    link
    fedilink
    arrow-up
    2
    ·
    5 days ago

    anaemic* (Sorry, that bothered me for some reason.)

    As for capture groups, you’ll have to find another way. Perversely, perhaps BusyBox continues to be included on certain systems because they know that the extra space is required for the code that works around BB’s shortcomings. That sounds asinine until you realise that “solving the problem properly” most likely leads to that one XKCD comic about the proliferation of competing standards.

    At worst, multiple sizes of BusyBox itself.