From owner-cvs-all@FreeBSD.ORG Sun Jun 6 02:30:11 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7CF9416A4D0; Sun, 6 Jun 2004 02:30:11 -0700 (PDT) Received: from kientzle.com (h-66-166-149-50.snvacaid.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id E364A43D2D; Sun, 6 Jun 2004 02:30:10 -0700 (PDT) (envelope-from kientzle@freebsd.org) Received: from freebsd.org (p54.kientzle.com [66.166.149.54]) by kientzle.com (8.12.9/8.12.9) with ESMTP id i569Tx90060427; Sun, 6 Jun 2004 02:30:00 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <40C2E401.5010400@freebsd.org> Date: Sun, 06 Jun 2004 02:29:37 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031006 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bruce Evans References: <20040605053115.45AE416A585@hub.freebsd.org> <20040605000326.B54841@root.org> <40C22518.6060406@kientzle.com> <20040606143616.W2060@gamplex.bde.org> In-Reply-To: <20040606143616.W2060@gamplex.bde.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Tim Kientzle cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org cc: Nate Lawson Subject: Re: cvs commit: src/lib/libarchive archive_read_extract.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2004 09:30:11 -0000 Bruce Evans wrote: > On Sat, 5 Jun 2004, Tim Kientzle wrote: > >>>>+ if (stat(name, &st) == 0 && S_ISDIR(st.st_mode)) > > Perhaps this or a nearby stat() should be lstat(). libarchive doesn't > use a single lstat() (though bsdtar does). No, this should be stat(). Otherwise, you cannot extract through an existing symlink. (E.g., some people need to be able to do the following: ln -s /other/disk /usr/ports bsdtar xf ports.tgz Also, note that---apart from the "extract" function---libarchive doesn't deal with stuff on disk. It just knows how to assemble/disassemble archives. It has very little reason to use either stat() or lstat(). > In fact, this stuff is quite broken. After "cd /tmp; ln -s /tmp foo", > tarring up foo[/.] gives the following misbehaviours with yesterday's > versions of tars: > > tar cf z foo: > only puts foo in the archive (correct) > bsdtar cf z foo: > same, except bsdtar seems to be too smart about padding the output > to a block boundary for regular files, so subsequent piping of the > file might not work The default padding behavior for bsdtar was changed quite a while ago to not pad regular files; are you sure you're up-to-date? > tar cf z foo/: > only puts foo in the archive (broken) > bsdtar cf z foo/: > same Here, bsdtar cf z foo/ does follow the symlink, which I presume you believe to be the correct behavior? > tar cf z foo/.: > puts files named foo/./* in the archive (everything under /tmp except > z). Warns about not attempting to put the archive inside itself. > bsdtar cf z foo/.: > same, except it silently puts a truncated copy of the archive inside > itself. Yes, bsdtar does not yet have a check for visiting the archive itself. I agree that this is broken. Tim