From owner-freebsd-bugs@FreeBSD.ORG Thu May 26 11:20:06 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BF10C16A43A for ; Thu, 26 May 2005 11:20:06 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1724A43D55 for ; Thu, 26 May 2005 11:20:01 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j4QBK1m9081528 for ; Thu, 26 May 2005 11:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j4QBK1jW081527; Thu, 26 May 2005 11:20:01 GMT (envelope-from gnats) Resent-Date: Thu, 26 May 2005 11:20:01 GMT Resent-Message-Id: <200505261120.j4QBK1jW081527@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, Hirohisa Yamaguchi Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C1B0616A41C for ; Thu, 26 May 2005 11:13:26 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9C32643D48 for ; Thu, 26 May 2005 11:13:26 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j4QBDQke067779 for ; Thu, 26 May 2005 11:13:26 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j4QBDPLg067777; Thu, 26 May 2005 11:13:26 GMT (envelope-from nobody) Message-Id: <200505261113.j4QBDPLg067777@www.freebsd.org> Date: Thu, 26 May 2005 11:13:26 GMT From: Hirohisa Yamaguchi To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: bin/81495: hexdump(1) format option does not allow literal '%' in output 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: Thu, 26 May 2005 11:20:07 -0000 >Number: 81495 >Category: bin >Synopsis: hexdump(1) format option does not allow literal '%' in output >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 26 11:20:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Hirohisa Yamaguchi >Release: 6.0-CURRENT >Organization: >Environment: >Description: I cannot get literal '%' in hexdump(1) output with any format_string. Though the man page mentions exceptions in fprintf-style format, there's no explanation why '%' cannot be printed. >How-To-Repeat: exec hexdump(1) with format_string which contains '%%' to get literal '%' in output. e.g.) $ echo foo | hexdump -e '"" /1 "%%%02x" "\n"' I got: hexdump: %%: bad conversion character >Fix: a) If there's any historical reasons to be so, update the man page; to mention that literal '%' cannot be included in output. or b) fix it. I wrote a patch, not thoroughly tested. And flag name is, perhaps, not appropriate. --- src/usr.bin/hexdump/parse.c.orig Thu Jul 22 22:14:42 2004 +++ src/usr.bin/hexdump/parse.c Thu May 26 19:22:28 2005 @@ -383,6 +383,10 @@ isint2: switch(fu->bcnt) { badconv(p1); } break; + case '%': + /* skip over '%' */ + pr->flags = F_ADDRESS; + break; default: p1[1] = '\0'; badconv(p1); >Release-Note: >Audit-Trail: >Unformatted: