From owner-freebsd-bugs@FreeBSD.ORG Mon Nov 19 17:20:02 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 C741816A46D for ; Mon, 19 Nov 2007 17:20:02 +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 AA15613C45B for ; Mon, 19 Nov 2007 17:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id lAJHK2Qb059657 for ; Mon, 19 Nov 2007 17:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id lAJHK2OD059656; Mon, 19 Nov 2007 17:20:02 GMT (envelope-from gnats) Resent-Date: Mon, 19 Nov 2007 17:20:02 GMT Resent-Message-Id: <200711191720.lAJHK2OD059656@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, Ulrich Spörlein Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E620C16A418 for ; Mon, 19 Nov 2007 17:15:57 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by mx1.freebsd.org (Postfix) with ESMTP id 761EF13C447 for ; Mon, 19 Nov 2007 17:15:57 +0000 (UTC) (envelope-from uspoerlein@gmail.com) Received: by nf-out-0910.google.com with SMTP id b2so1478481nfb for ; Mon, 19 Nov 2007 09:15:45 -0800 (PST) Received: by 10.86.80.5 with SMTP id d5mr5206498fgb.1195490920965; Mon, 19 Nov 2007 08:48:40 -0800 (PST) Received: from coyote.spoerlein.net ( [85.180.161.178]) by mx.google.com with ESMTPS id l19sm7159342fgb.2007.11.19.08.48.40 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Nov 2007 08:48:40 -0800 (PST) Received: from coyote.spoerlein.net (localhost [127.0.0.1]) by coyote.spoerlein.net (8.14.1/8.13.8) with ESMTP id lAJGmceu037969; Mon, 19 Nov 2007 17:48:38 +0100 (CET) (envelope-from q@coyote.spoerlein.net) Received: (from q@localhost) by coyote.spoerlein.net (8.14.1/8.13.8/Submit) id lAJGmcrD037968; Mon, 19 Nov 2007 17:48:38 +0100 (CET) (envelope-from q) Message-Id: <200711191648.lAJGmcrD037968@coyote.spoerlein.net> Date: Mon, 19 Nov 2007 17:48:38 +0100 (CET) From: Ulrich Spörlein To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/118132: [PATCH] pax(1): broken -s handling of \1, \2 ... 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: Mon, 19 Nov 2007 17:20:02 -0000 >Number: 118132 >Category: bin >Synopsis: [PATCH] pax(1): broken -s handling of \1, \2 ... >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: Mon Nov 19 17:20:02 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Ulrich Spörlein >Release: FreeBSD 6.2-STABLE i386 >Organization: 1822direkt.com >Environment: >Description: I was using pax(1) on RHEL 4 to be able to transform filenames upon extraction, this breaks under FreeBSD (and at least Ubuntu 7.04, too) >How-To-Repeat: % mkdir foo % touch foo/bar_baz % echo foo/bar_baz|pax -rw -s ',^[^/]*/\(.*\)_baz$,\1,gp' /tmp pax: Replacement name error foo/bar_baz >Fix: I stole the patch from the Debian bugtracker: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=451361 After recompile: % echo foo/bar_baz | /usr/obj/usr/src/bin/pax/pax -rw -s ',^[^/]*/\(.*\)_baz$,\1,gp' /tmp foo/bar_baz >> bar This should be reported upstream, but I couldn't find a definitive source for our pax(1). Someone should test this on other *BSDs, too. --- pax.diff begins here --- --- bin/pax/pat_rep.c.orig Mon Nov 19 17:37:11 2007 +++ bin/pax/pat_rep.c Mon Nov 19 17:38:39 2007 @@ -76,7 +76,7 @@ #ifdef NET2_REGEX static int resub(regexp *, char *, char *, char *); #else -static int resub(regex_t *, regmatch_t *, char *, char *, char *); +static int resub(regex_t *, regmatch_t *, char *, char *, char *, char *); #endif /* @@ -929,7 +929,7 @@ # ifdef NET2_REGEX if ((res = resub(pt->rcmp,pt->nstr,outpt,endpt)) < 0) { # else - if ((res = resub(&(pt->rcmp),pm,pt->nstr,outpt,endpt)) + if ((res = resub(&(pt->rcmp),pm,inpt,pt->nstr,outpt,endpt)) < 0) { # endif if (prnt) @@ -1071,7 +1071,7 @@ */ static int -resub(regex_t *rp, regmatch_t *pm, char *src, char *dest, +resub(regex_t *rp, regmatch_t *pm, char *orig, char *src, char *dest, char *destend) { char *spt; @@ -1121,7 +1121,7 @@ */ if (len > (destend - dpt)) len = destend - dpt; - if (l_strncpy(dpt, src + pmpt->rm_so, len) != len) + if (l_strncpy(dpt, orig + pmpt->rm_so, len) != len) return(-1); dpt += len; } --- pax.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: