FS#12063 - [initscripts] At the end of /etc/rc.sysinit there is a useless check
Attached to Project:
Arch Linux
Opened by Francesco Frassinelli (frafra) - Sunday, 09 November 2008, 17:11 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 07 June 2009, 14:07 GMT
Opened by Francesco Frassinelli (frafra) - Sunday, 09 November 2008, 17:11 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 07 June 2009, 14:07 GMT
|
Details
Description:
In /etc/rc.sysinit there is a useless check: 419 # Save our dmesg output from this boot 420 if [ -f /var/log/dmesg.log ]; then 421 /bin/rm /var/log/dmesg.log 422 fi 423 /bin/dmesg > /var/log/dmesg.log The lines between 419 and 422 are useless, because in 423 is used the operator ">", that redirects the output *overwriting* the current file. This check will be ok only if the operator was ">>", that appends the output at the end of file. |
This task depends upon
Closed by Thomas Bächler (brain0)
Sunday, 07 June 2009, 14:07 GMT
Reason for closing: Fixed
Additional comments about closing: commited Hugo's fix to git
Sunday, 07 June 2009, 14:07 GMT
Reason for closing: Fixed
Additional comments about closing: commited Hugo's fix to git
[djgera@gerardo ~]$ touch hola
-bash: hola: cannot overwrite existing file
[djgera@gerardo ~]$ ls >| hola
[djgera@gerardo ~]$
From bash(1):
If the redirection operator is >, and the noclobber option to the set builtin has been enabled, the redirection will fail if the file whose name
results from the expansion of word exists and is a regular file. If the redirection operator is >|, or the redirection operator is > and the
noclobber option to the set builtin command is not enabled, the redirection is attempted even if the file named by word exists.
$ set -o noclobber
$ touch hola
$ ls > hola
-bash: hola: cannot overwrite existing file
$ ls >| hola
$