Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Aug 2019 16:24:49 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 229616] bin/dd does not check output's close() return code
Message-ID:  <bug-229616-227-zuEoOOx5ND@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-229616-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-229616-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229616

--- Comment #3 from Thomas Hurst <tom@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=3Dfsync

Illumos:

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

Coreutils:

 * Checks close() on both input and output
 * Checks ferror()/fclose() on stdout if arg parsing fails
 * Supports conv=3Dfsync and fdatasync
 * Supports oflag=3Dsync, 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=3Dfsync 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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-229616-227-zuEoOOx5ND>