oxidecomputer/helios

etc/default/tar should not default to /dev/rmt/0

Closed this issue · 1 comments

We don't have tape drives, so we shouldn't allow tar to default to trying to use one. While this is another side effect of the inevitability of errors being made by even the most experienced and well-intentioned support personnel when executing commands in the Unix shell environment, this means that an erroneous tar command can easily fill up the root filesystem by trying to create an archive there. The result is a regular file that is arbitrarily large; e.g.,

                     | 09:16            |   BRM27230009 # pwd
                    │09:16            |   /dev/rmt
                    │09:16            |   BRM27230009 # ls -l 0
                    │09:16            |   -rw-r--r--   1 root     root     3249799168 Oct 18 06:07 0

We can help our support personnel avoid this outcome by modifying the defaults.

If we remove the default file entirely, tar will always prompt for a device argument:

gimlet-sn06 # tar c .
tar: device argument required

This also does the right thing with a device number parameter (which would otherwise take the parameters against archiveN in the default file).

gimlet-sn06 # tar c0 .
tar: device argument required
gimlet-sn06 # tar c5 .
tar: device argument required
gimlet-sn06 # tar cf /tmp/test.tar .
gimlet-sn06 #