From owner-freebsd-bugs@freebsd.org Sun Aug 18 16:24:50 2019 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C129CB28A for ; Sun, 18 Aug 2019 16:24:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 46BMpV0qMwz3DP4 for ; Sun, 18 Aug 2019 16:24:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 19C9CCB289; Sun, 18 Aug 2019 16:24:50 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 197A8CB288 for ; Sun, 18 Aug 2019 16:24:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46BMpT6pS0z3DP3 for ; Sun, 18 Aug 2019 16:24:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0B804CCD for ; Sun, 18 Aug 2019 16:24:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x7IGOngR060622 for ; Sun, 18 Aug 2019 16:24:49 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x7IGOnFs060621 for bugs@FreeBSD.org; Sun, 18 Aug 2019 16:24:49 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 229616] bin/dd does not check output's close() return code Date: Sun, 18 Aug 2019 16:24:49 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: easy, needs-patch, needs-qa X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: tom@hur.st X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: mfc-stable11? mfc-stable12? X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2019 16:24:50 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229616 --- Comment #3 from Thomas Hurst --- 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.=