From owner-freebsd-bugs@FreeBSD.ORG Thu May 1 09:30:03 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12498137 for ; Thu, 1 May 2014 09:30:03 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00BAB13B4 for ; Thu, 1 May 2014 09:30:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.8/8.14.8) with ESMTP id s419U29x057106 for ; Thu, 1 May 2014 09:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s419U22n057105; Thu, 1 May 2014 09:30:02 GMT (envelope-from gnats) Date: Thu, 1 May 2014 09:30:02 GMT Message-Id: <201405010930.s419U22n057105@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Thomas Quinot Subject: Re: bin/189174: dd conv=sparse bs=64k EINVAL on sparse last block X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Thomas Quinot List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 May 2014 09:30:03 -0000 The following reply was made to PR bin/189174; it has been noted by GNATS. From: Thomas Quinot To: bug-followup@freebsd.org Cc: Subject: Re: bin/189174: dd conv=sparse bs=64k EINVAL on sparse last block Date: Thu, 1 May 2014 11:28:25 +0200 * FreeBSD-gnats-submit@FreeBSD.org, 2014-05-01 : > >Category: bin > >Responsible: freebsd-bugs > >Synopsis: dd conv=sparse bs=64k EINVAL on sparse last block > >Arrival-Date: Thu May 01 09:20:00 UTC 2014 The following fix appears to fix the problem here: Index: dd.c =================================================================== --- dd.c (révision 265172) +++ dd.c (copie de travail) @@ -450,13 +450,16 @@ nw = cnt; } else { if (pending != 0) { - if (force) + /* If forced to write, and we have no data left, we need + * to write an explicit 0. + */ + if (force && cnt == 0) pending--; if (lseek(out.fd, pending, SEEK_CUR) == -1) err(2, "%s: seek error creating sparse file", out.name); - if (force) + if (force && cnt == 0) write(out.fd, outp, 1); pending = 0; }