I have been exploring advanced usage of `lsof` and realized that the repeat mode `lsof -r [t[c<N>][m<fmt>]]` is not working on Gentoo. Poking around I see that for some reason the ebuild does not detect/use `strftime(3)`... Reproducible: Always Steps to Reproduce: 1. Run `lsof -r 1c1m=%T= /etc/resolv.conf` Actual Results: lsof: illegal <fmt>: "=%T=" lsof 4.98.0 latest revision: https://github.com/lsof-org/lsof latest FAQ: https://github.com/lsof-org/lsof/blob/master/00FAQ latest (non-formatted) man page: https://github.com/lsof-org/lsof/blob/master/Lsof.8 usage: [-?abhHKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-E] [+|-e s] [+|-f[gG]] [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [-o [o]] [-p s] [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names] Use the ``-h'' option to get more help information. Expected Results: =10:55:16=
Created attachment 865794 [details, diff] hardcode -DHAS_STRFTIME in ebuild After some tinkering, I hardcoded -DHAS_STRFTIME in the ebuild and it works for me. I hope you have a more elegant solution, may be we are missing other features of autoconfig? Note that I get the following warning with my ebuild several times: autotools/autotools.h:70: warning: "HAS_STRFTIME" redefined Also both current and my modified ebuild detect strftime normally during configure: checking for strftime... yes
1. ./configure does detect it properly, and sets HAVE_STRFTIME in config.h 2. autotools.h includes config.h and sets HAS_STRFTIME if HAVE_STRFTIME 3. lsof.h includes autotools.h if -DAUTOTOOLS (that is passed) Then about everything includes lsof.h... except util.c which uses HAS_STRFTIME but does *not* include lsof.h, nor autotools.h. Works for me if lsof.h included in util.c -- so looks like an upstream issue. Reason it may work on other distros is because some of them are still using the legacy ./Configure (like Arch), which is not autoconf.
O! Thanks for the quick reply, let me try to chase that upstream then (I just submitted PR, ignore it).
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e505057e5ec18ae8b98d22d9cf1955ce0a46fad commit 1e505057e5ec18ae8b98d22d9cf1955ce0a46fad Author: Sam James <sam@gentoo.org> AuthorDate: 2023-07-19 22:42:28 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-07-19 22:42:28 +0000 sys-process/lsof: backport strftime fix Closes: https://bugs.gentoo.org/910547 Signed-off-by: Sam James <sam@gentoo.org> .../lsof-4.98.0-fix-common-include-strftime.patch | 28 +++++++++++ sys-process/lsof/lsof-4.98.0-r1.ebuild | 58 ++++++++++++++++++++++ 2 files changed, 86 insertions(+)