From owner-freebsd-current@FreeBSD.ORG Fri Aug 15 06:02:24 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12D081DA for ; Fri, 15 Aug 2014 06:02:24 +0000 (UTC) Received: from kefka.worrbase.com (kefka.csh.rit.edu [129.21.49.25]) (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 ADAA829B0 for ; Fri, 15 Aug 2014 06:02:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]); by kefka.worrbase.com (OpenSMTPD) with ESMTP id 4482edc1; for ; Thu, 14 Aug 2014 22:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=worrbase.com; h= x-mailer:mime-version:date:date:message-id:subject:subject :content-type:content-type:from:from:received:received; s=mail; t=1408082129; x=1409896530; bh=JUrno1PgnQR4G1THG1U8itS+lRveVKV2 uOD6aGbuWiw=; b=M1MRtUYc4WOHXbXnw6KU3S25j0hpgbKaeIbpvnd4PJbPyg+2 mGyQ0O+ncUTKShFgWRMV70P42c+xinz26zXCHAtskrtEcTRiRxOcaUJBWGD15akA 30nfTKtkE+xdzFw3LO2R+8b70gK4iwYPJyV0Pd8jCg1+1ZDtDvrTm7UGebGBpN45 Tozciftyq71aMScoqlLf5ve2vdUnwlj2HeMz79gpHv5/HKP151PZXYQibg2tJSRm Vq4k0CDpY51w5Fq3df34cigs6T6HRDVEZijcJzG+F3RntMDa0BxJsq8KvWiPoWBi PvreIVqavimEGgiKvlU6YHh7jqHN9rhvRZkllOnFnJqB/XMhDYlu7fZqbWSjzwG2 DAy1dj3sVukSrJ4hA2z9+x/kkx+mFRTswSRTlvh7ljvZN4X8U0qXMNo+GPbVW/PT 5D9ylMzaZY2FUIPw7wsvBkfzLYbPpl1H16QmVQOIzMCAQ/0qGre3YQfbAysNI00+ e+o+ctZOwpwaY/5VVsBjI3+71FYa0qirDaZio3hHdp9WafSzDYehEViGIt/+M5EB 88KwkIipQv5Tgj3CRNvONRr9mCLwrCFxiDUosGE8+WyES8nSGUWsUY7EUuVaksJp FVVwPEOoyG8yy4zXLrUnSx4xoljpldTXda+AUmnAeeNoblVpz7b/Utuoo2I= X-Virus-Scanned: amavisd-new at worrbase.com Received: from kefka.worrbase.com ([IPv6:::1]) by localhost (kefka.worrbase.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id dZvlsmi4VuQw for ; Thu, 14 Aug 2014 22:55:29 -0700 (PDT) Received: from [10.0.1.3] (c-50-161-97-206.hsd1.ca.comcast.net [50.161.97.206]); by kefka.worrbase.com (OpenSMTPD) with ESMTPSA id e00e2163; TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO; for ; Thu, 14 Aug 2014 22:55:28 -0700 (PDT) From: William Orr Content-Type: multipart/signed; boundary="Apple-Mail=_233B94A7-E514-471C-8B17-784D39D4D1EA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Subject: Inconsistent behavior with dd(1) Message-Id: <3C86F281-D618-4B93-BBA3-2DA33AC407EC@worrbase.com> Date: Thu, 14 Aug 2014 22:55:25 -0700 To: freebsd-current@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) X-Mailer: Apple Mail (2.1878.6) X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2014 06:02:24 -0000 --Apple-Mail=_233B94A7-E514-471C-8B17-784D39D4D1EA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hey, I found some inconsistent behavior with dd(1) when it comes to = specifying arguments in -CURRENT. [ worr on terra ] ( ~ ) % dd if=3D/dev/zero of=3D/dev/null = count=3D18446744073709551616 dd: count: Result too large [ worr on terra ] ( ~ ) % dd if=3D/dev/zero of=3D/dev/null = count=3D18446744073709551617 dd: count: Result too large [ worr on terra ] ( ~ ) % dd if=3D/dev/zero of=3D/dev/null = count=3D18446744073709551615 dd: count cannot be negative [ worr on terra ] ( ~ ) % dd if=3D/dev/zero of=3D/dev/null = count=3D-18446744073709551615 1+0 records in 1+0 records out 512 bytes transferred in 0.000373 secs (1373071 bytes/sec) [ worr on terra ] ( ~ ) % dd if=3D/dev/zero of=3D/dev/null count=3D-1 dd: count cannot be negative =97 Any chance someone has the time and could take a look? = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D191263 Thanks, William Orr =97 Here=92s the patch: Index: bin/dd/args.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- bin/dd/args.c (revision 267712) +++ bin/dd/args.c (working copy) @@ -186,46 +186,31 @@ static void f_bs(char *arg) { - uintmax_t res; - - res =3D get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "bs must be between 1 and %jd", = (intmax_t)SSIZE_MAX); - in.dbsz =3D out.dbsz =3D (size_t)res; + in.dbsz =3D out.dbsz =3D get_num(arg); + if (in.dbsz < 1 || out.dbsz < 1) + errx(1, "bs must be between 1 and %ju", (uintmax_t)-1); } =20 static void f_cbs(char *arg) { - uintmax_t res; - - res =3D get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "cbs must be between 1 and %jd", = (intmax_t)SSIZE_MAX); - cbsz =3D (size_t)res; + cbsz =3D get_num(arg); + if (cbsz < 1) + errx(1, "cbs must be between 1 and %ju", (uintmax_t)-1); } =20 static void f_count(char *arg) { - intmax_t res; - - res =3D (intmax_t)get_num(arg); - if (res < 0) - errx(1, "count cannot be negative"); - if (res =3D=3D 0) - cpy_cnt =3D (uintmax_t)-1; - else - cpy_cnt =3D (uintmax_t)res; + cpy_cnt =3D get_num(arg); } =20 static void f_files(char *arg) { - files_cnt =3D get_num(arg); if (files_cnt < 1) - errx(1, "files must be between 1 and %jd", = (uintmax_t)-1); + errx(1, "files must be between 1 and %ju", = (uintmax_t)-1); } =20 static void @@ -241,14 +226,10 @@ static void f_ibs(char *arg) { - uintmax_t res; - if (!(ddflags & C_BS)) { - res =3D get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "ibs must be between 1 and %jd", - (intmax_t)SSIZE_MAX); - in.dbsz =3D (size_t)res; + in.dbsz =3D get_num(arg); + if (in.dbsz < 1) + errx(1, "ibs must be between 1 and %ju", = (uintmax_t)-1); } } =20 @@ -262,14 +243,10 @@ static void f_obs(char *arg) { - uintmax_t res; - if (!(ddflags & C_BS)) { - res =3D get_num(arg); - if (res < 1 || res > SSIZE_MAX) - errx(1, "obs must be between 1 and %jd", - (intmax_t)SSIZE_MAX); - out.dbsz =3D (size_t)res; + out.dbsz =3D get_num(arg); + if (out.dbsz < 1) + errx(1, "obs must be between 1 and %ju", = (uintmax_t)-1); } } =20 @@ -378,11 +355,14 @@ uintmax_t num, mult, prevnum; char *expr; =20 + if (val[0] =3D=3D '-') + errx(1, "%s: cannot be negative", oper); + errno =3D 0; num =3D strtouq(val, &expr, 0); if (errno !=3D 0) /* Overflow or = underflow. */ err(1, "%s", oper); -=09 + if (expr =3D=3D val) /* No valid digits. */ errx(1, "%s: illegal numeric value", oper); =20 Index: bin/dd/dd.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- bin/dd/dd.c (revision 267712) +++ bin/dd/dd.c (working copy) @@ -284,8 +284,6 @@ =20 for (;;) { switch (cpy_cnt) { - case -1: /* count=3D0 was = specified */ - return; case 0: break; default: --Apple-Mail=_233B94A7-E514-471C-8B17-784D39D4D1EA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJT7aDNAAoJEOWIWopNkblkQ1MP/0KH4PyTj907Uppcw+vZgfVr DFw8cslqSrmDVV4H9jByFmi2H8orCwDC4Viv2gwOerZ0KkUgj0qZTJmQrYu5vPK/ xno9AIIoq5BPaCWz9Rou1/nQEMzJmxHOEuaqx5+m9mE8xMCmO75mF1c8BzuUgpAv 7oPDNokH+BOpSU70+PWXoIBu/r1bwyb8qKpBtFw1MKKLceaYPzvmmG5dlo5FGZgl /ChfQR5bwkYMMSRABzY4DBo9+eE1MFNYYasHCA5asSdENdU02NeWwTxYtrKZtuE5 IQGGXqVutHwYJYCQgx4elr9PFXqdkI4ZtvKhwWFaItMxLVQJphYioDf7Bip3Jzsw IBVxAEkJ9zqxK3o5JwTUobQKz0p9KOP9136P6E/pEsyiLnAnvefSmzJFHhXklKhb CmHijeRqIAH4BT6P2a+Ut9JyMdxYh5Yt7NQCCK3uYw3xiRDZ5R9Q/knru2HCLMnu SqUaL0rgZ200/icyfAjXnEgcbRxTD7m2/zJu2WAUd9/MaHworbgWmIsuThKH/2LV Uy99SEMfJoiQR9oXpWUNKtTZIbPt/Aj76l1plflxnEP9CWzbn26yZC7LvLmniL5c dy8X+PEdi4qkJ23/eWGifaa9Mg38ZdQwqkDOK52qrAdPYY9PVkevOAUFSESO+4Uf 62kWPf6bzHfeA/IXnJ4h =14jE -----END PGP SIGNATURE----- --Apple-Mail=_233B94A7-E514-471C-8B17-784D39D4D1EA--