Moonchild wrote: ↑2026-04-26, 19:59
Sorry to be blunt, but isn't using a known tool available across oses more consistent than generic languages like perl or Python that can and will vary version to version and are often locked to distro specifics?
So, wouldn't that promote the use of autoconf or a known shell? I mean... Bash will act the same on linux, bsd and windows... But python might not, (see e.g breaking changes between python 3.10 and 3.14... And that is even just a minor version difference...
Just hostly wondering if we're not making things harder, not easier, even regardless of the fact that I don't know Perl at all
Well, honestly, there's no silver bullet, and that's one reason why I think there's a good argument in favor of leaving things as they are and dealing with issues as they come up, only considering migrating something off of whatever it's on if we have repeated issues in that area that would be solved by doing so (like with Python and people constantly not being able to compile Python 2 on Linux). In many cases, any change is potentially just trading one set of problems for another.
Like, if I compare shell to Python... I see it as something like two different kinds of poison. Python is mostly an instance of what I like to call, "version hell"... it changes a lot from version to version, but is fairly consistent across platforms. If I write something in Python, then for the most part I know the same version of Python will work similarly across Windows, Linux, and other platforms. Especially inside venv or virtualenv, which is part of the reason why they set that up in the first place, to avoid any distro-specific packages polluting the vendored Python packages. So Python is actually much more consistent across platforms than shell, but less consistent across versions. I know sometimes it seems like issues don't show up in MozillaBuild, but that's because it uses a locked version of Python. If you install a newer Python like Linux users have and then use PATH manipulation to make sure MozillaBuild uses it, you will see pretty much all the issues they are reporting without switching platforms (unless we explicitly gated the place where they hit the error behind a platform flag).
In contrast, shell is the reverse. Shells haven't changed much over time and have known quirks, but it's "cross-platform hell," because all the POSIX-ish utilities it relies on work a bit differently from platform to platform. Even if you wanted to standardize on bash (we currently don't, and turning it into a build requirement would likely annoy all the platforms that
don't ship bash as /bin/sh), then the other utilities like grep, awk, etc... all have platform specific quirks. We would have to not only mandate use of Bash, but also GNU coreutils to make behavior consistent, which some distros like Ubuntu are moving away from even within Linux. And we'd likely have to use TOOLCHAIN_PREFIX in a lot more places and tell people to invoke the GNU versions of utilities explicitly, saying that we won't just support whatever POSIX-ish utilities your distro ships with, and won't support you unless you try GNU Coreutils and Bash first. I don't imagine that would go over well. Though I will be honest, if we could do that, it would make using shell a lot less painful. It's just not "the Unix way," if you know what I mean.
As a case in point... there a was a time when a certain person who used to work on this project kept wanting to replace pieces of Python with "simple POSIX sh scripts," as he called them, and it seemed like every other time he would do it, it would cause weird problems on obscure Linux distros that don't default to Bash, one of the BSDs, or SunOS. I never dared say this when he was around, but I kind of hated those shell scripts for that reason, and honestly that's what soured me on the idea of doing everything as shell scripts instead of Python. Because as bad as Python is/was... it wasn't as annoying as dealing with a random mix of tools from random vendors that are all named the same thing and all vaguely POSIX compliant but different in just enough ways that you can't trust them 100%. It also doesn't help that most people who think they know something is POSIX compliant are totally wrong and only managed to test on maybe two or three popular shells that happened to support an extension they were using. If there is one good thing about Python, that I have grudgingly come to appreciate from spending months on that port... it's that at least version differences are well-documented, and people complain loudly en masse about new versions breaking things all at once. So any problem we have with it, someone else has had before and likely complained. And that kind of research isn't as easy to do with implementations of sh and coreutils, though it certainly can be done, it's just buried a little deeper.
The only reason I mention Perl at all, is simply because I've found it to be a tool that is very conservative in behavior compared to Python, and also fairly consistent in behavior across platforms. I would also say that about GNU m4, which autoconf is written in. So the way I'm seeing it is... autoconf, perl, and GNU make are known, fairly conservative tools that are not changing fast. Python is reasonably consistent cross-platform, but changes really fast across versions. Shell is reasonably consistent across time, but varies a lot between platforms.
So yeah, I'm definitely not advocating for getting rid of autoconf or GNU make. I'm just saying... maybe I'm not eager to see more things that invoke a #!/bin/sh shebang in the tree and use a ton of utilities like grep, awk, or sed. I suppose it won't hurt anything to keep the battle-tested ones we have (I've never been a believer in change for the sake of change anyway), but I definitely think it's safe to say I don't think it's the right direction for new code.
But really, what I'm finding is that all the tools we use to build this have their strengths and weaknesses, and we just have to learn them well enough to find what works well in what contexts through trial and error. It should probably be less of a "replace X with Y," and more of a "replace this instance of X with this instance of Y, because of issues A, B, and C that are addressed by doing so." Like, let's say we run into an issue where different platform's shells or coreutils do different things... we could debug POSIX compliance. Or, in some cases, it would be easy to replace that shell script with a perl one-liner because perl works a lot like a shell with most coreutils integrated even though it's technically a scripting language. Or maybe there's a Python script that keeps getting hit by version change after version change, or Python just feels really sluggish to invoke for a simple task because it's such a heavy program, and eventually we decide to do that one thing in a Makefile, or an m4 macro, or a perl script, using whatever we deem the best tool for the job.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind