Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 08 Jul 2018 21:27:30 +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@https.bugs.freebsd.org/bugzilla/>

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

            Bug ID: 229616
           Summary: bin/dd does not check output's close() return code
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: tom@hur.st

In dd's main():

        dd_close();
        /*
         * Some devices such as cfi(4) may perform significant amounts
         * of work when a write descriptor is closed.  Close the out
         * descriptor explicitly so that the summary handler (called
         * from an atexit() hook) includes this work.
         */
        close(out.fd);
        exit(0);

dd_close() comments *claim* it flushes output, but this appears to be a lie=
 -
it just finishes off any pending calls to write(), it doesn't ask they be
flushed to disk.

IO errors from previous writes that were later flushed to disk can end up
reported in close(), for example as mentioned in close(2):

    [ENOSPC]           The underlying object did not fit, cached data was l=
ost

Obviously a dd that can exit 0 while also losing data is.. unfortunate.

--=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>