From owner-freebsd-current@FreeBSD.ORG Sun Mar 25 21:43:32 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E692C106564A; Sun, 25 Mar 2012 21:43:31 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 26F908FC19; Sun, 25 Mar 2012 21:43:30 +0000 (UTC) Received: by lboi15 with SMTP id i15so4707314lbo.13 for ; Sun, 25 Mar 2012 14:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=hKSsCpuuRp60WDbi8XHeN7C/qca0y1oxUQqDill78l0=; b=xiSeIbeBeBYvqjgNuD53CxOj9akfOgLUez2K4bfq+ko51ezJc4q+/kfB7XLIZL4y3Y 9qCPXzF5QaVRg2spr06wMxIlMOFe4p4evst6r1O/H+SXWdXMDqP2I+cBlGvJUJrC4MgK 4FKJDOd9EF8hUYPPlfOnSlOqFoQ+DcrxcjNpD4z3AU2ubPPPa/38v11tYRq9gqfBETyp 2eigaw3mLLKhTuGINlSGnS4t6tFZMhDLeYgmbaOHIJikYhC0TfD9BwzcIIIqJ7UiFRWc pywZP3+iaZngWEQEr6z09z4h9SAKDs9i13Ebh4Gwpmvy7x3OfCiGl9Ywodx74/N4KgWB xZRA== Received: by 10.112.27.198 with SMTP id v6mr7001203lbg.57.1332711809827; Sun, 25 Mar 2012 14:43:29 -0700 (PDT) Received: from localhost ([78.157.92.5]) by mx.google.com with ESMTPS id cr11sm19445022lbb.0.2012.03.25.14.43.28 (version=SSLv3 cipher=OTHER); Sun, 25 Mar 2012 14:43:28 -0700 (PDT) Date: Mon, 26 Mar 2012 00:43:27 +0300 From: Gleb Kurtsou To: Tim Kientzle Message-ID: <20120325214327.GA1238@reks> References: <4F6CD93D.70109@passap.ru> <4F6CEB1F.4040300@FreeBSD.org> <4F6D52DF.7080105@passap.ru> <4F34E618-DB66-464D-B5B2-900960D6C16B@kientzle.com> <4F6F155E.30902@passap.ru> <38D08B05-58E1-4266-9628-2C22836806D3@kientzle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <38D08B05-58E1-4266-9628-2C22836806D3@kientzle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Dimitry Andric , freebsd-current@freebsd.org, Boris Samorodov Subject: Re: /usr/bin/tar creates invalid lib file X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Mar 2012 21:43:32 -0000 On (25/03/2012 10:53), Tim Kientzle wrote: > > On Mar 25, 2012, at 5:53 AM, Boris Samorodov wrote: > > > On 24.03.2012 21:00, Tim Kientzle wrote: > >> > >> On Mar 23, 2012, at 9:51 PM, Boris Samorodov wrote: > >> > >> Can you send me the output of: > >> > >> tar -cvf /tmp/test.tar /usr/ports/devel/nspr/work/nspr-4.9/mozilla/nsprpub/build/dist/lib/../../pr/src/./libnspr4.so.1 > >> > >> (A tar archive containing only that one source file.) > >> > >> This looks similar to a bug that we found in libarchive recently > >> I didn't think that bug impacted FreeBSD, but I may have been > >> wrong…. if it did, it will be obvious from the structure of the > >> created archive. > > > > The following file is extracted after tarring: > > ----- > > % hd libnspr4.so.1 > > 00000000 32 0a 30 0a 30 0a 32 34 31 39 37 31 0a 30 0a 00 |2.0.0.241971.0..| > > 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > > * > > 00000200 > > ----- > > > > The tar file itself attached (3KB in length). > > Ugh. I'll probably need your help to diagnose this more precisely. > > Here is the root problem: tar thinks this is a sparse file > with nothing in it. On FreeBSD, bsdtar now uses > lseek(SEEK_HOLE) to identify holes in the file. For > some reason, bsdtar is storing this file as just one big hole. I experience a related issue. lseek(SEEK_HOLE) error checks are too strict. Files are not added to archive if lseek(SEEK_HOLE) fails. Ignoring lseek(SEEK_HOLE) at least in ENOTTY case would be preferable. I run stacked file system (PEFS) on top of ZFS. ZFS reports _PC_MIN_HOLE_SIZE, but ioctls to lower level fs disabled are in PEFS. I work around it by properly handling _PC_MIN_HOLE_SIZE. Test case: % for i in a b c; do echo $i > $i; done % tar cf 1.tar a b c tar: lseek(SEEK_HOLE) failed: Inappropriate ioctl for device tar: lseek(SEEK_HOLE) failed: Inappropriate ioctl for device tar: lseek(SEEK_HOLE) failed: Inappropriate ioctl for device % ls -l 1.tar -rw-r--r-- 1 gleb gleb 1024 Mar 26 00:28 1.tar % tar tf 1.tar # <-- no files in archive % truss log: __acl_get_link(0x801c8c100,0x2,0x801d82000,0x0,0x1000,0x0) ERR#22 'Invalid argument' extattr_list_link(0x801c8c100,0x1,0x0,0x0,0x7fffffffc530,0x0) ERR#45 'Operation not supported' pathconf("a",0x15) = 512 (0x200) open("a",O_NONBLOCK,037777751270) = 5 (0x5) lseek(5,0x0,0x3) ERR#25 'Inappropriate ioctl for device' close(5) = 0 (0x0) tar: write(2,"tar: ",5) = 5 (0x5) Thanks, Gleb. > > There are a lot of things here that don't make sense: > > * The extracted file should be all zero bytes. (The 2.0.0.241971.0. is the sparse file map, it's not really part of the file.) How are you extracting this? > > * Can you run the tar command under truss or ktrace and look for calls to lseek()? That would help verify that this is really a tar bug and not a filesystem or kernel bug. > > I'll spend some time today to see if I can reproduce the problem here. > > Tim > > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"