1. 15

  2. [Comment removed by author]

    1. 3

      Thanks! Yes I’m glad to hit this milestone, since I’ve been working on this project for a long time. Something useful is in sight!

      At first I thought that autoconf-generated configure scripts should be the easiest type of script to run. They jump through hoops to be extremely portable to all types of shells.

      This is true, but it’s also true that the code is quite subtle and pedantic. It technically falls under POSIX, but there’s a lot of stuff that normal shell users might not use, e.g. tricky uses of “eval”.

      But I have many non-POSIX bash constructs working and tested as well, so configure doesn’t test everything in OSH.

      I actually need some suggestions of easily testable bash programs to run. Batch scripts which have deterministic output are the best, so I can diff the output (as opposed to say an init.d script). I’ve been working on debootstrap, but it must run as root so it’s a little annoying.

      Maybe some Alpine Linux scripts for building containers and such…?

      1. 2

        You probably already know this, but libtool is another well known large shell script.

        1. 2

          Do you know which projects use it and where to look for it in the source tarball? I know Python doesn’t use it, since it uses distutils (in Python) for logic to build shared libraries across many platforms.

          libtool is probably like configure – restricted to POSIX shell. I’m also looking for big bash scripts like debootstrap (a huge shell script at the foundation of Debian.)

          But I’m interested in trying it! Builds are good test cases because you can test the binary afterward.

          1. 1

            Warning: libtool was a major inspiration for this PHK essay. It’s a good read but the libtool stuff sounds nuts. Worth cleaning up but you need to learn M4, too.


            1. 2

              Well if libtool is like autoconf in that it generates POSIX shell scripts, I’m actually only interested in running the output shell scripts. I’m not going to mess with any M4.

              I daydreamed about trying to replace autoconf, but that’s too masochistic even for me. The saving grace of bash is that it can be statically parsed. This is impossible with M4 as far as I know – parsing and execution are interleaved.

              Also it seems like a lot of people are using cmake, like LLVM. autoconf/libtool are not universal like bash is.

            2. 1

              GNU Libtool source tarball is available at https://www.gnu.org/software/libtool/

      2. 2

        I wrote this tool https://github.com/andrewchambers/ddmin for debugging exactly the type of problem you faced.

        1. 2

          Cool! I didn’t know about this algorithm. Bookmarked the paper.

          Myrddin also looks cool. It actually seems like what I want for the shell, a systems language with algebraic data types (and I’m not really a fan of Rust). But I think I need to slowly evolve the code and not do a big bang rewrite.

          1. 1

            Myrddin is a great language which beats basically everything in my eyes for little tools like this. Even such a small program takes advantage of generic hash tables, stdlib bitsets and pattern matching. Much nicer than trying to use things like that from C or C++.

            It has rough edges, but it’s such a small language basically anyone can start contributing.