Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910547 - sys-process/lsof-4.98.0 does not find strftime at compile time
Summary: sys-process/lsof-4.98.0 does not find strftime at compile time
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux bug wranglers
URL: https://github.com/lsof-org/lsof/issu...
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2023-07-19 09:02 UTC by Kalin KOZHUHAROV
Modified: 2023-07-19 22:45 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
hardcode -DHAS_STRFTIME in ebuild (BGO910547.diff,409 bytes, patch)
2023-07-19 09:24 UTC, Kalin KOZHUHAROV
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kalin KOZHUHAROV 2023-07-19 09:02:13 UTC
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=
Comment 1 Kalin KOZHUHAROV 2023-07-19 09:24:31 UTC
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
Comment 2 Ionen Wolkens gentoo-dev 2023-07-19 09:37:45 UTC
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.
Comment 3 Kalin KOZHUHAROV 2023-07-19 10:02:00 UTC
O! Thanks for the quick reply, let me try to chase that upstream then (I just submitted PR, ignore it).
Comment 4 Larry the Git Cow gentoo-dev 2023-07-19 22:45:36 UTC
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(+)