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

Trek trek00 at inbox.ru
Mon Sep 14 22:01:06 BST 2020

On Tue, 1 Sep 2020 00:10:47 +0200 (CEST)
Thorsten Glaser <t.glaser at tarent.de> wrote:

> 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.
> [...]
> 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.  

after some thinking, I would like to not include this variant, because
it does not fix the /proc file bug with dash, making the bug only more
subtle to find as it would not appear on bash and mksh

I think it would be better to use the $(cat) construct on those
bugged /proc files (commenting the code) and a plain read on the others

what do you think about?

just another question, as it seems you are the right person to ask

to print the ansi escape codes for the fancy output on
lsb/init-functions, I would like to use the printf utility as it works
reliability on different shells, but mksh (and others) does not have
this builtin, so in that case echo should be used instead: by chance
do you know a better approach?



More information about the Debian-init-diversity mailing list