Bug#923478: initscripts use unsafe `: >` shell command to create files

Dmitry Bogatov KAction at debian.org
Sat Apr 6 20:14:10 BST 2019


[2019-04-05 11:11] Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn at axis.com>
> Thing is neither the `:' nor the `true' commands are needed.  To 
> truncate a file it's sufficient to redirect _nothing_ to that file.
>
> 	 $ dash -c '>/tmp/dir/; echo $?; echo hello world;'         
> 	dash: 1: cannot create /tmp/dir/: Is a directory
> 	2
> 	hello world

Nice to know. Is this behaviour mandated by posix? If yes, we could
simplify code futher.

> The real problem is that a failing redirection is _not_ error handled 
> (in the /etc/init.d/bootmisc.sh case).

Sorry, failed to parse. You seems to tell, that there is another problem
in 'bootmisc.sh', but I do not understand, which one.


-- 
        Note, that I send and fetch email in batch, once every 24 hours.
                 If matter is urgent, try https://t.me/kaction
                                                                             --




More information about the Debian-init-diversity mailing list