"Paul Eggert"<[email protected]&gt;&nbsp;writes:

&gt;On&nbsp;2026-09-08&nbsp;19:26,&nbsp;ii&nbsp;via&nbsp;GNU&nbsp;coreutils&nbsp;Bug&nbsp;Reports&nbsp;wrote:
&gt;&nbsp;The&nbsp;pre-write&nbsp;check&nbsp;is&nbsp;safe&nbsp;and&nbsp;does&nbsp;not&nbsp;affect&nbsp;the&nbsp;write&nbsp;even&nbsp;if&nbsp;probing&nbsp;fails.
&gt;&nbsp;It&nbsp;merely&nbsp;warns&nbsp;and&nbsp;prompts&nbsp;for&nbsp;confirmation
&gt;
&gt;Something&nbsp;like&nbsp;that&nbsp;might&nbsp;be&nbsp;OK&nbsp;as&nbsp;a&nbsp;new&nbsp;option,&nbsp;but&nbsp;it&nbsp;shouldn't&nbsp;be&nbsp;the&nbsp;default;&nbsp;too&nbsp;many&nbsp;scripts&nbsp;routinely&nbsp;use&nbsp;dd&nbsp;to&nbsp;overwrite&nbsp;devices&nbsp;containing&nbsp;file&nbsp;system&gt;s,&nbsp;and&nbsp;there&nbsp;may&nbsp;not&nbsp;be&nbsp;anybody&nbsp;around&nbsp;to&nbsp;prompt&nbsp;(or&nbsp;the&nbsp;user&nbsp;may&nbsp;not&nbsp;expect&nbsp;a&nbsp;prompt&nbsp;or&nbsp;know&nbsp;what&nbsp;to&nbsp;do&nbsp;with&nbsp;it).
&gt;


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&nbsp;is a new, optional flag. Without it, 
dd&nbsp;behaves exactly as before. The default behavior remains unchanged.


Non‑interactive safety: When /dev/tty&nbsp;is unavailable (e.g., in cron or 
background jobs), dd&nbsp;prints the warning on stderr and proceeds 
automatically,
it never hangs or fails. The function ask_to_proceed()&nbsp;returns 
true&nbsp;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]

Attachment: dd-pre-write-safety-check.patch
Description: Binary data

Reply via email to