"Paul Eggert"<[email protected]> writes:
>On 2026-09-08 19:26, ii via GNU coreutils Bug Reports wrote: > The pre-write check is safe and does not affect the write even if probing fails. > It merely warns and prompts for confirmation > >Something like that might be OK as a new option, but it shouldn't be the default; too many scripts routinely use dd to overwrite devices containing file system>s, and there may not be anybody around to prompt (or the user may not expect a prompt or know what to do with it). > Thank you for your prompt and thoughtful feedback.This revised patch is a direct response to your comments, specifically, that the safety check should not be the default and must not interfere with unattended scripts. The current implementation addresses both concerns as follows: Opt‑in only: oflag=check is a new, optional flag. Without it, dd behaves exactly as before. The default behavior remains unchanged. Non‑interactive safety: When /dev/tty is unavailable (e.g., in cron or background jobs), dd prints the warning on stderr and proceeds automatically, it never hangs or fails. The function ask_to_proceed() returns true if it cannot open the controlling terminal. Please let me know if you have further suggestions or if any adjustments are needed. I am happy to revise again. thanks, Jianing Weng ii [email protected]
dd-pre-write-safety-check.patch
Description: Binary data
