Speculating on why DKMS and other Linux things are large shell scripts
I've mentioned that one of the practical issues with DKMS is thatit's a giant Bash script and that Bashisn't the right language for large programs . I'm sure that these issuesaren't new to the authors of DKMS ,so an obvious question to ask is why did they chose to use Bash forDKMS. In fact you could ask this about a surprising number ofrelatively substantial programs on a typical Linux system. Dracut is 2,000 linesof Bash, for
Unix job control has some dark corners and challenging cases, illustrated
Recently I learned that the common Linux version of vipw doessome odd things with your terminal's foreground process group,one of the cores of Unix job control , due to a change made in late 2019 ( via ).It does this to fix a problem that's described in the issue and sort of in the commit ,but neither the issue nor the commit discuss the larger context ofwhy all of this is needed. Also, the fix has a small omission which cancause problems in
Unix job control and its interactions with TTYs (and shells)
For a user, Unix's job control gives you more or less two things.First, you can stop a program you're running with Ctrl-Z (usually), andoften then have it run in the background for a while if you want (oryou may want it to just stop, for example so it stops using up all ofyour CPU). Second, it lets you multiplex your terminal between multipleprograms that all want to interact with you. You can Ctrl-Z the current
Downsampling your metrics data is a compromise (what we could call a 'hack')
In a comment on my entry on the size of our Prometheus setup , mappu raised an interesting issue:
I've always thought the default infinite-retention of Prometheus'data stores to be ridiculous when coming from RRD-based monitoringsolutions like Munin.
It's not useful to keep 15-second resolution indefinitely, RRD is theright thing to do, and it's a shame it's such a weird hack to get thatbehaviour on top of Prometheus.
I've come to disagree with
The size of our Prometheus setup as of May 2021
At this point we've been running our Prometheus setup in production since November 21st2018. This start date matters because one of our peculiarities isthat we have yet to expire any metrics; we've kept everything backto the start of production, which means that we now have about twoand a half years of accumulated metrics. We're still runningPrometheus on the same hardware from the end of 2019 , with its database stored on a mirroredpair of 4 TB
The Bourne shell and Bash aren't the right languages for larger programs
In my recent entry on DKMS , Isaid some negative things about it being an almost 4,000 line longBash script. In comments, a couple of people questioned this; forinstance, Arnaud Gomes asked:
I seem to recall a post of yours a few years ago about the maindifference between the shell and python being that a shell program isbasically just glue between external commands. Isn't it what DKMS is?
(Arnaud Gomes is probably thinking of this entry on the gulf betweenshells
The Bourne shell lets you set variables in if expressions
Today I was writing some Bourne shell code where I wanted to run acommand, gather its output (if any), and see whether or not itsucceeded. My standard form for this is:
res="$(... whatever ...)"if [ "$?" -eq 0 ]; then ... ...fi
(I could potentially use a pipeline to process the command's output, but there can be reasons to capture the output .Here I deliberately
Firefox and the challenge of trying to make visited links clearly visible
I wish I could work out a way in the Stylus Firefox addon toforce-style visited links in something distinctive. In theory it'seasy; in practice Firefox seems to sharply limit how you can stylethem these days for privacy, and my attempts so far aren't all thatsuccessful.
I frequently read articles on the Internet that have plenty of linksto other interesting things, some of which I've read and some ofwhich I haven't and would like to. On
Errors during SMTP conversations aren't trustworthy, illustrated
Recently we had a mail problemwhere we could not deliver email to a particular remote destinationfor a while. A major Australian ISP spent six days telling us:
421 4.7.25 Temporarily rejected. Reverse DNS forfailed. IB108 (Based on Exim log messages, this happened during the initial SMTPconnection, before we even EHLO'd.)
Then later the ISP was fine again, sadly after the person trying to sendmail had their attempts time
DKMS built one of my kernel modules for the wrong kernel
I recently tweeted :
Today I discovered that DKMS hasspent some time silently (re)building one of my modules for the wrongkernel because DKMS. Naturally it didn't work. Since it was my sensormonitoring, I didn't notice for a while.
There is a complicated story here. This happened on my officeworkstation , which needs a very out of treeversion of the
it87module in order to read the motherboard sensors. Because of ongoingproblems in the 5.11 kernel seriesMenu
![]()