[Bug 229616] bin/dd does not check output's close() return code

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Aug 18 16:24:50 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229616

--- Comment #3 from Thomas Hurst <tom at hur.st> ---
So, did a bit of research to see what everyone else is doing.

NetBSD:

 * Checks close() on output
 * fsync() on output if it's stdout (where close() may simply decrement a
refcount)

OpenBSD:

 * Does not close() at all
 * Supports conv=fsync

Illumos:

 * Checks close() on output, and also fclose(stdout)
 * Supports conv=fsync and fdatasync
 * Supports oflag=sync and dsync for synchronous writes

Coreutils:

 * Checks close() on both input and output
 * Checks ferror()/fclose() on stdout if arg parsing fails
 * Supports conv=fsync and fdatasync
 * Supports oflag=sync, dsync, and direct
 * EINTR-checking loops for close() and f*sync()

So FreeBSD's bit of an outlier, being the only dd without any fsync support at
all, and calling close() explicitly but not checking it succeeds.

I'm thinking we could do a hybrid of NetBSD and OpenBSD's approaches:

1. Check close()
2. Also check fsync() if output is stdout
3. Add conv=fsync support

Other options might be nice to have, but aren't needed to ensure data is on
stable storage after dd is finished, which is the most important point.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list