[PATCH] vars.sh: remove unnecessary fork to speedup boot/upgrades

Thorsten Glaser t.glaser at tarent.de
Mon Aug 31 23:10:47 BST 2020


On Mon, 31 Aug 2020, Adam Borowski wrote:

> I don't think we should throw away a significant (10% w/o color / 5% with)
> speed-up just because of a bug _somewhere else_.

Hmph.

But I found something to possibly work around both this bug and
the speed penalisation depending on shell implementation.

At least GNU bash “cheats” and uses larger reads and seeks on
procfs files (and others, some of which aren’t safe to) instead
of one-byte reads.

Not using one-byte reads but large reads works around the bug
in procfs file access.

mksh can be told to use large reads with a shell-specific option
to read.

Considering that only GNU bash, dash and mksh are eligible for
/bin/sh in Debian, and only mksh sets $KSH_VERSION out of these,
we can do:

	read -r${KSH_VERSION:+N-1} cmdline </proc/cmdline

This is agreeable. This does 'read -r cmdline' on other shells,
and 'read -rN-1 cmdline' on mksh.

> For containers/VMs, boot speed matters a lot.

Not for containers, they don’t boot.

For VMs, opinions differ. I switch all mine to sequential boot
to have them operate reliably.

bye,
//mirabilos
-- 
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”	(#nosec)    ‣‣‣ Please let MySQL and MariaDB finally die!



More information about the Debian-init-diversity mailing list