Dangerous commands (was:[ANNOUNCE] fstests: for-next branch updated to v2024.02.04)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Hi,

reading [1] and how late it was found that effectively a "rm -rf /" can
happen makes me worried about what I can expect from fstests after git
pull. Many people contribute and the number for custom _cleanup()
functions with unquoted 'rm' commands is just asking for more problems.

[1] https://lore.kernel.org/all/20240205060016.7fgiyafbnrvf5chj@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Unquoted arguments in shell scripts is IMO a big anti-pattern,
unfortunately present everywhere in xfstests since the beginning.
Rewriting all scripts would be quite a lot of work, could you at least
provide safe versions of the cleanup helpers?

For example:

_rm_tmp() {
    rm -rf -- $tmp
}

and used as

_cleanup() {
    _rm_tmp
}

or at least mandate the "--" separator and quoting arguments in new code
and gradually fix the existing code.

I can send patches at least for btrfs and generic as this affects me but
first I'd like to know that this will become standard coding style
requirement in fstests.




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux