From: David Sterba <dsterba@suse.cz>
To: fstests@vger.kernel.org, zlang@redhat.com
Subject: Dangerous commands (was:[ANNOUNCE] fstests: for-next branch updated to v2024.02.04)
Date: Wed, 21 Feb 2024 15:09:51 +0100 [thread overview]
Message-ID: <20240221140951.GJ355@suse.cz> (raw)
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.
next reply other threads:[~2024-02-21 14:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-21 14:09 David Sterba [this message]
2024-02-21 16:13 ` Dangerous commands (was:[ANNOUNCE] fstests: for-next branch updated to v2024.02.04) 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240221140951.GJ355@suse.cz \
--to=dsterba@suse.cz \
--cc=fstests@vger.kernel.org \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox