public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* Dangerous commands (was:[ANNOUNCE] fstests: for-next branch updated to v2024.02.04)
@ 2024-02-21 14:09 David Sterba
  2024-02-21 16:13 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: David Sterba @ 2024-02-21 14:09 UTC (permalink / raw)
  To: fstests, zlang

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@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com/

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.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-02-29 20:05 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 14:09 Dangerous commands (was:[ANNOUNCE] fstests: for-next branch updated to v2024.02.04) David Sterba
2024-02-21 16:13 ` Darrick J. Wong
2024-02-27  3:40   ` Zorro Lang
2024-02-29 18:44   ` David Sterba
2024-02-29 20:05     ` Eric Biggers
2024-02-23  3:53 ` Dave Chinner
2024-02-25 15:37   ` Zorro Lang
2024-02-29 19:19   ` David Sterba
2024-02-25 15:16 ` Zorro Lang
2024-02-25 16:51   ` Eric Biggers
2024-02-25 17:03     ` Darrick J. Wong
2024-02-25 17:45       ` Eric Biggers
2024-02-26  2:56         ` Zorro Lang
2024-02-26 18:18           ` Darrick J. Wong
2024-02-26 18:56         ` Darrick J. Wong
2024-02-27  5:18           ` Eric Biggers
2024-02-26  2:25       ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox