Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Mar 2022 08:29:06 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 262293] sysutils/archivemount gives errors after mounting the 13.0 release tarballs
Message-ID:  <bug-262293-7788-yVseHTEFQp@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-262293-7788@https.bugs.freebsd.org/bugzilla/>
References:  <bug-262293-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262293

--- Comment #1 from Bill Blake <billblake2018@gmail.com> ---
In an attempt to further isolate the bug, I tried using a different package,
fuse-zip, with a zipped up /usr/ports.  And--got the same bug.  No, the pro=
blem
isn't in fuse itself, it's two separate bugs, one in fuse-zip and one in
archivemount.  In both cases, the link count for directories (and for
archivemount at least, files), is computed incorrectly.  For archivemount t=
he
link count is always returned as zero.  For fuse-zip, the "link count" is
actually the number of entries in the directory.

Either way, the incorrect link count confuses the directory traversal code =
of
fts.c because it uses that count to optimize away unnecessary stat calls.  =
And
this ultimately led du to generate the error messages that I saw.  It also
breaks find but, apparently, not diff -r.  Be that as it may, this is a ser=
ious
bug and needs some sort of repair.  (Ditto for the bug in fuse-zip, though
that's for a different PR.)

And here is an awful hack to fix the bug.  THIS IS NOT A CORRECT FIX.  Firs=
t,
it always sets the link count to 1 for non-directories.  Second, it is prob=
ably
unnecessarily inefficient.  But it suffices to set the link count for
directories correctly, which makes du and find work.  This patches
archivemount.c:

@@ -1545,6 +1545,20 @@
        stbuf->st_blocks  =3D (stbuf->st_size + 511) / 512;
        stbuf->st_blksize =3D 4096;

+       if (S_ISDIR(stbuf->st_mode)) {
+               stbuf->st_nlink =3D 2;
+               NODE *child, *tmp;
+               HASH_ITER(hh, node->child, child, tmp) {
+                       const struct stat *chbuf =3D
archive_entry_stat(child->entry);
+                       if (S_ISDIR(chbuf->st_mode)) {
+                               ++stbuf->st_nlink;
+                       }
+               }
+       } else {
+               stbuf->st_nlink =3D 1;
+       }
+

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-262293-7788-yVseHTEFQp>