When building against musl libc (and probably any other libc where glob is missing GLOB_ALTDIRFUNC) and using GCC 15.x, the build fails due to the incompatible pointer types for the two readdir functions. GCC-15 makes this an error even when -Werror is disabled:
compatglob.c: In function 'glob3':
compatglob.c:585:29: error: assignment to 'struct dirent * (*)(void)' from incompatible pointer type 'struct dirent * (*)(void *)' [-Wincompatible-pointer-types]
585 | readdirfunc = pglob->gl_readdir;
| ^
compatglob.c:587:29: error: assignment to 'struct dirent * (*)(void)' from incompatible pointer type 'struct dirent * (*)(DIR *)' [-Wincompatible-pointer-type]
587 | readdirfunc = readdir;
| ^
In file included from compatglob.c:75:
/usr/include/dirent.h:27:16: note: 'readdir' declared here
27 | struct dirent *readdir(DIR *);
| ^~~~~~~
Hacking the prototype and using a cast fixes the build...
--- a/compat/lib/compatglob.c
+++ b/compat/lib/compatglob.c
@@ -562,7 +562,7 @@
* and dirent.h as taking pointers to differently typed opaque
* structures.
*/
- struct dirent *(*readdirfunc)();
+ struct dirent *(*readdirfunc)(void *);
*pathend = EOS;
errno = 0;
@@ -584,7 +584,7 @@
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
readdirfunc = pglob->gl_readdir;
else
- readdirfunc = readdir;
+ readdirfunc = (struct dirent * (*)(void *))readdir;
while ((dp = (*readdirfunc)(dirp))) {
u_char *sc;
Char *dc;
but my knowledge of the C standard isn't strong enough to know if this is reasonable or a time bomb.
I don't have any other good ideas for fixing it, particularly since I don't know how well the remaining extended glob features are supported. (If ALTDIRFUNC is all that is missing, you could use compatglob only when ALTDIRFUNC is needed.)
Thank you for this report.
I've quickly hacked together what I think is the correct fix in the branch v0.4b54-wip
This commit in particular I believe will fix this (and the endian includes issues)
https://sourceforge.net/p/dump/code/ci/721f0e1b65af1ec1de9c959c92281d1a7197aaae/
I haven't actually tested with musl which is still on my "I wish I had time to get this working" list but I think iwyu is now clean so hopefully I'm not relying on any debian/gcc specific includes.
I very much doubt I'll merge that commit exactly as it is now, I've done this in a hurry and it probably could do with some cleanup work :-) But if it works for you (at least the bits that you need) then as least I know I'm on the right track.
dump itself builds OK on that branch, but faketape/dump-info.cpp is missing
sys/stat.h:and bswap_header.cpp is missing... something else:
Another try - I've force pushed that branch. sys/stat.h was just a iwyu problem, I've added an extra mapping to iwyu.imp so hopefully it won't recur. bswap_header.cpp was an ext2 header weirdness - ext2_ext_attr.h doesn't pull in the right headers so it needed reordering. On a debian build there's another __u32 being pulled in first which is why it worked for me.
The entire branch includes work to fix what I think is an s390x endianness issue but it hasn't been tested yet except via a very convoluted qemu plus patched libfuse on amd64.
Looks good now! I re-ran all of the non-destructive tests you suggested to me on https://sourceforge.net/p/dump/feature-requests/16/, and everything appears to be working.
One last request (not pressing) while I am being annoying: on Gentoo, we are disabling link-time optimization (LTO) for dump because it fails to build with
CFLAGS="-Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"all of which tend to indicate problems that could confuse LTO. If this is easy to fix, it may avoid some surprises, especially for users who blindly enable LTO without those safeguards.Oh, that was a bad one! I guess I need a newer compiler to reproduce.
I've fixed it on the v0.4b54-wip branch and cleaned that up. If that works for you I'll merge it in as a new release.
The 0.4b55-wip branch has the other stuff on it (plus what I was working on today) but this definitely isn't ready for release yet.
Yep that fixed it, thanks again.
0.4b54 is now released.
0.4b54 is now released.