From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 15 18:20:01 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE18716A4D0 for ; Sat, 15 Dec 2007 18:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 89CED13C4EA for ; Sat, 15 Dec 2007 18:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lBFIK1Gu024580 for ; Sat, 15 Dec 2007 18:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lBFIK1Zt024579; Sat, 15 Dec 2007 18:20:01 GMT (envelope-from gnats) Resent-Date: Sat, 15 Dec 2007 18:20:01 GMT Resent-Message-Id: <200712151820.lBFIK1Zt024579@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Mark Adler Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5528D16A4C8 for ; Sat, 15 Dec 2007 18:10:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 40BE013C459 for ; Sat, 15 Dec 2007 18:10:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lBFI9rab031932 for ; Sat, 15 Dec 2007 18:09:53 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id lBFI9r87031927; Sat, 15 Dec 2007 18:09:53 GMT (envelope-from nobody) Message-Id: <200712151809.lBFI9r87031927@www.freebsd.org> Date: Sat, 15 Dec 2007 18:09:53 GMT From: Mark Adler To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/118723: [patch] od/hexdump truncates last partial repeat line X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Dec 2007 18:20:01 -0000 >Number: 118723 >Category: misc >Synopsis: [patch] od/hexdump truncates last partial repeat line >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Dec 15 18:20:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Mark Adler >Release: hexdump 1.19 (same problem with 1.22) >Organization: >Environment: Darwin gromit 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc >Description: od and hexdump truncates the last line of the dump when that line partially repeats the previous line. >How-To-Repeat: Create this 40-byte file (including five newline characters): abcdefg 0123456 abcdefg 0123456 abcdefg (Just the first three lines, 24 bytes, shows the same problem, but I included five lines to make the structure more evident.) od on that file incorrectly gives: 0000000 060542 061544 062546 063412 030061 031063 032065 033012 * 0000040 which leaves off the last line "abcdefg\n", and incorrectly shows the final address as 40 octal (32 decimal). Similarly, hexdump gives the following with the same issues: 0000000 6162 6364 6566 670a 3031 3233 3435 360a * 0000020 With the patch below, od then correctly displays: 0000000 060542 061544 062546 063412 030061 031063 032065 033012 * 0000040 060542 061544 062546 063412 0000050 and hexdump then correctly displays: 0000000 6162 6364 6566 670a 3031 3233 3435 360a * 0000020 6162 6364 6566 670a 0000028 >Fix: Patch relative to latest version (1.22): *** display-122.c Tue Aug 3 19:47:32 2004 --- display.c Sat Dec 15 09:51:26 2007 *************** *** 263,279 **** errx(1, "cannot skip past end of input"); if (need == blocksize) return((u_char *)NULL); - /* - * XXX bcmp() is not quite right in the presence - * of multibyte characters. - */ - if (vflag != ALL && - valid_save && - bcmp(curp, savp, nread) == 0) { - if (vflag != DUP) - (void)printf("*\n"); - return((u_char *)NULL); - } bzero((char *)curp + nread, need); eaddress = address + nread; return(curp); --- 263,268 ---- >Release-Note: >Audit-Trail: >Unformatted: