Skip to content

lslogins: Add support for lastlog2#2735

Merged
karelzak merged 12 commits intoutil-linux:masterfrom
schubi2:lslogins-lastlog2
Feb 14, 2024
Merged

lslogins: Add support for lastlog2#2735
karelzak merged 12 commits intoutil-linux:masterfrom
schubi2:lslogins-lastlog2

Conversation

@schubi2
Copy link
Contributor

@schubi2 schubi2 commented Jan 25, 2024

This PR based on Thorsten Kukuk's PR #2164.
I have adapted it to lastlog2 which is meanwhile included into util-linux.

Copy link
Member

@t-8ch t-8ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance for a testcase? :-)

@karelzak
Copy link
Collaborator

I don't like get_lastlog2() and original get_lastlog(). It would be nice to cache the lastlog entry in the struct lslogins_user to avoid many seek & reads (and SQL requests in lastlog2). But it's unrelated to this pull request, and it is better to address it with another PR.

@schubi2
Copy link
Contributor Author

schubi2 commented Jan 30, 2024

Any chance for a testcase? :-)

Yes, you are right :-) I have added one.

@schubi2
Copy link
Contributor Author

schubi2 commented Jan 31, 2024

Hm, there are some issues in the build environments. E.G. fedora:
nothing provides liblastlog2.so.2(LIBLASTLOG2_2_40)(64bit) needed by util-linux-2.40.rc1-4.20240125171921182063.pr2735.4.gbf7f26be8.fc40.x86_64
And it seems that some debian builds do not have "sqlite3".

@t-8ch
Copy link
Member

t-8ch commented Jan 31, 2024

For debian have a look at .github/workflows/cibuild-setup-ubuntu.sh
For Fedora I don't know.

@t-8ch
Copy link
Member

t-8ch commented Jan 31, 2024

For Fedora maybe .packit.yaml needs to be adapted so it modifies util-linux.spec to specify that liblastlog2 is provided by util-linux itself.
But that is mostly a guess.

@schubi2
Copy link
Contributor Author

schubi2 commented Feb 1, 2024

I do not get it:

nothing provides liblastlog2.so.2()(64bit) needed by util-linux-2.40.rc1-4.20240125171921182063.pr2735.4.gbf7f26be8.fc40.x86_64

I cannot find any requirement in the *.spec file under:

https://copr-dist-git.fedorainfracloud.org/git/packit/util-linux-util-linux-2735/util-linux in the given branch.

Where is this requirement still defined ?

@t-8ch
Copy link
Member

t-8ch commented Feb 1, 2024

I think the requirement is extracted from the actual lsogins binary that is being built.
And the spec file does not define a package that contains the liblastlog2.

@karelzak
Copy link
Collaborator

karelzak commented Feb 2, 2024

The spec file is from the official Fedora rawhide, and it needs to be updated for v2.40-rc1. I'll update it ...

@karelzak
Copy link
Collaborator

karelzak commented Feb 2, 2024

BTW, we need to do something with login-utils/login.c. Now, it directly reads/writes to the classic last log file. This code should be optional (and enabled/disabled) independently on lastlog2 as you can replace it with old pam_lastlog or new pam_lastlog2.

I suggest introducing #ifdef USE_LOGIN_LASTLOG and --enable-login-lastlog and making it disabled by default for the next release with some highlight warnings in ReleaseNotes.

@schubi2
Copy link
Contributor Author

schubi2 commented Feb 2, 2024

I suggest introducing #ifdef USE_LOGIN_LASTLOG and --enable-login-lastlog and making it disabled by default for the next release with some highlight warnings in ReleaseNotes.

Ok, good point. Will do it...

@schubi2
Copy link
Contributor Author

schubi2 commented Feb 6, 2024

I suggest introducing #ifdef USE_LOGIN_LASTLOG and --enable-login-lastlog and making it disabled by default for the next release with some highlight warnings in ReleaseNotes.

Ok, good point. Will do it...

Have done it :-)

@karelzak
Copy link
Collaborator

karelzak commented Feb 14, 2024

The rpm-build:fedora-rawhide-* test does not pass because nothing on Fedora provides liblastlog2.so. I need to change it on Fedora. It is better than fixing it with some workaround in .packit.yaml.

@karelzak karelzak merged commit 39c3125 into util-linux:master Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants