Bug 240549 - devel/dbus: Loops over all possible file descriptors (Use closefrom(2))
Summary: devel/dbus: Loops over all possible file descriptors (Use closefrom(2))
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-desktop (Team)
URL: https://gitlab.freedesktop.org/dbus/d...
Keywords: needs-qa, performance
Depends on: 236815
  Show dependency treegraph
Reported: 2019-09-13 00:04 UTC by rozhuk.im
Modified: 2021-05-14 21:00 UTC (History)
4 users (show)

See Also:
rozhuk.im: maintainer-feedback?
rozhuk.im: merge-quarterly?

patch (654 bytes, patch)
2019-09-13 00:04 UTC, rozhuk.im
rozhuk.im: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rozhuk.im 2019-09-13 00:04:52 UTC
Created attachment 207447 [details]

Use closefrom() to avoid call close() for all possible descriptors
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-09-13 04:15:28 UTC
This change is best suited to submitting upstream first. Please create an issue or PR upstream, and add the issue/PR URL reference to the patch so we can track the patch locally until a future release comes out with the change
Comment 2 rozhuk.im 2019-11-03 17:45:52 UTC
Comment on attachment 207447 [details]

Upstream PR: https://gitlab.freedesktop.org/dbus/dbus/merge_requests/124
Comment 3 rozhuk.im 2020-02-19 16:29:05 UTC
Comment 4 rozhuk.im 2020-04-16 07:50:44 UTC
maintainer timeout
Comment 5 commit-hook freebsd_committer 2021-05-14 19:08:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=aee4556063e8770fd0e4fd28a29f30626d6e235a

commit aee4556063e8770fd0e4fd28a29f30626d6e235a
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2021-05-13 22:57:15 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2021-05-14 19:08:18 +0000

    devel/dbus: use closefrom()

    Don't do 1021 calls to close() when a single closefrom() will do.
    This patch has been submitted upstream (by the reporter) but
    is languishing there; there's a big difference between upstream's
    development branch and the released stable version. I've taken
    the initial patch from FreeBSD bugzilla, lightly mutated it with
    upstream work.

    PR:             240549
    Reported by:    rozhuk.im@gmail.com

 devel/dbus/Makefile                                 |  2 +-
 .../files/patch-cmake_ConfigureChecks.cmake (new)   | 10 ++++++++++
 devel/dbus/files/patch-cmake_config.h.cmake (new)   | 12 ++++++++++++
 .../dbus/files/patch-dbus_dbus-sysdeps-unix.c (new) | 21 +++++++++++++++++++++
 4 files changed, 44 insertions(+), 1 deletion(-)
Comment 6 rozhuk.im 2021-05-14 19:16:55 UTC
(In reply to commit-hook from comment #5)
+#cmakedefine   HAVE_CLOSEFROM 1
+#ifdef __FreeBSD__

Why __FreeBSD__ and not HAVE_CLOSEFROM?
Comment 7 Adriaan de Groot freebsd_committer 2021-05-14 21:00:37 UTC
The buildsystem is (still) autotools and the patch that is in the DBus MR doesn't apply cleanly to the older (stable) version we ship; I could adjust it to patching the configure.ac from the release, but that means then running all the autotools as part of the build. And for what? There's no version of ports that we care about, that would not end up defining HAVE_CLOSEFROM; I suppose I could have used `#if 1` as well.

I do hope the MR lands upstream, but development seems a bit bogged down there.