From owner-freebsd-stable@FreeBSD.ORG Thu Sep 20 23:44:10 2007 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8037216A418 for ; Thu, 20 Sep 2007 23:44:10 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from falcon.cybervisiontech.com (falcon.cybervisiontech.com [217.20.163.9]) by mx1.freebsd.org (Postfix) with ESMTP id 3BE4413C458 for ; Thu, 20 Sep 2007 23:44:10 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from localhost (localhost [127.0.0.1]) by falcon.cybervisiontech.com (Postfix) with ESMTP id 836A543F4DB for ; Thu, 20 Sep 2007 19:09:17 +0300 (EEST) X-Virus-Scanned: Debian amavisd-new at falcon.cybervisiontech.com Received: from falcon.cybervisiontech.com ([127.0.0.1]) by localhost (falcon.cybervisiontech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xRsxJyLEt8Fm for ; Thu, 20 Sep 2007 19:09:14 +0300 (EEST) Received: from [10.2.1.87] (gateway.cybervisiontech.com.ua [88.81.251.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by falcon.cybervisiontech.com (Postfix) with ESMTP id C1A2443F4D0 for ; Thu, 20 Sep 2007 19:09:13 +0300 (EEST) Message-ID: <46F29B3B.3010304@icyb.net.ua> Date: Thu, 20 Sep 2007 19:09:31 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.6 (X11/20070803) MIME-Version: 1.0 To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: pax misbehavior X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2007 23:44:10 -0000 Preparation first: $ mkdir xxxxx $ cd xxxxx/ $ touch yyyyy $ ln -s yyyyy yyyyy.0 $ ln -s yyyyy.0 yyyyy.0.0 $ cd .. Demonstration of expected behavior: $ pax -w -f xxxxx.tar -s "#xxxxx#zzzzz#" xxxxx $ pax -vf xxxxx.tar drwxr-xr-x 2 ... 0 20 Sep 18:51 zzzzz -rw-r--r-- 1 ... 0 20 Sep 18:51 zzzzz/yyyyy lrwxr-xr-x 1 ... 0 20 Sep 18:51 zzzzz/yyyyy.0 => yyyyy lrwxr-xr-x 1 ... 0 20 Sep 18:51 zzzzz/yyyyy.0.0 => yyyyy.0 pax: ustar vol 1, 4 files, 10240 bytes read, 0 bytes written. Demonstration of misbehavior: $ pax -w -f xxxxx.tar -s "#xxxxx#zzzzz#" -s "#.*##" xxxxx $ pax -vf xxxxx.tar drwxr-xr-x 2 ... 0 20 Sep 18:51 zzzzz -rw-r--r-- 1 ... 0 20 Sep 18:51 zzzzz/yyyyy pax: ustar vol 1, 2 files, 10240 bytes read, 0 bytes written. The only thing added in the second test is -s "#.*##" option _after_ the first -s option. Mysteriously it caused all symlinks to not be included into an archive. But this should not happen if the behavior in the first test is correct and pax follows POSIX specification: if an entry is handled by the first -s (which it was in the first test), then further -s options should not be applied to it. Our man page also says it: Multiple -s expressions can be specified. The expressions are applied in the order they are specified on the com- mand line, terminating with the first successful substitution. Of course, this synthetic test is a simplification of something done for a real task with a real purpose. -s "#.*##" is meant to exclude from an archive all "other" files and the side-effect of excluding symlinks as well is very unfortunate. Should I file a PR ? -- Andriy Gapon