There is an extern declaration of the global variable environ (which
has no portable header that defines it) that is unused on FreeBSD due
to zfs_setproctitle_init() being a stub.
Reported by: GCC
Differential D38231
zfs: Disable -Wunused-variable for environ in main in zfs_main.c. jhb on Jan 27 2023, 7:00 PM. Authored by Tags None Referenced Files
Details There is an extern declaration of the global variable environ (which Reported by: GCC
Diff Detail
Event TimelineComment Actions would it be worth the effort to fix this upstream? something like: diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 9d48b2b32..2e48ca680 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -8672,7 +8672,6 @@ main(int argc, char **argv) int i = 0; const char *cmdname; char **newargv; - extern char **environ; (void) setlocale(LC_ALL, ""); (void) setlocale(LC_NUMERIC, "C"); diff --git a/include/libzutil.h b/include/libzutil.h index 4d4bddaad..948ac08cd 100644 --- a/include/libzutil.h +++ b/include/libzutil.h @@ -183,6 +183,7 @@ _LIBZUTIL_H int printf_color(const char *color, const char *format, ...); _LIBZUTIL_H const char *zfs_basename(const char *path); _LIBZUTIL_H ssize_t zfs_dirnamelen(const char *path); #ifdef __linux__ +extern char **environ; _LIBZUTIL_H void zfs_setproctitle_init(int argc, char *argv[], char *envp[]); _LIBZUTIL_H void zfs_setproctitle(const char *fmt, ...); #else Comment Actions
I prefer that if someone's willing to shepherd it in, but in the meantime adding the warning flag is sensible. Comment Actions For now I've merged this change, but it should be reverted once an upstream fix is merged back to main. Comment Actions Upstream change has been merged in, so it's now just a matter of waiting until it comes back to FreeBSD |