On 15/06/2025 18:10, Alexey Gladkov wrote:
On Sun, Jun 15, 2025 at 04:25:15PM +0100, Harald van Dijk wrote:
On 15/06/2025 16:09, Alexey Gladkov wrote:
On Sun, Jun 15, 2025 at 03:35:17PM +0100, Harald van Dijk wrote:
util-linux's version of switch_root does the same ramfs/tmpfs check that
busybox does, but reacts to it differently: rather than exiting with an
error for other file systems, it simply prints a warning and carries on
without removing any files. Would doing that instead in busybox too be
enough to work for your use case?
Yes, it will absolutely be better than a fatal error. I'm using
switch_root in initramfs and of course I'd like to clean up root, but this
way at least I can use switch_root from busybox.
That should be a fairly simple change, that should just be a matter of
changing the bb_(simple_)error_msg_and_die to the non-_and_die variant
to continue printing the message but carrying on, and then skipping over
the delete_contents("/", rootdev).
Is it possible to add an option to delete content from root ?
Also a good suggestion.
Ok, great!
I'm not very familiar with the busybox codebase.
Does this patch look acceptable ?
To my non-maintainer eyes, that looks good, thanks.
Whether it's enough to cover the concerns in the comment
// Additional sanity checks: we're about to rm -rf /, so be REALLY SURE
// we mean it. I could make this a CONFIG option, but I would get email
// from all the people who WILL destroy their filesystems.
I'm not qualified to comment on, will leave that for others. :)
Cheers,
Harald van Dijk
_______________________________________________
busybox mailing list
busybox@busybox.net
https://lists.busybox.net/mailman/listinfo/busybox