Bug 275508 - sysutils/bsdisks: ensure uid_t is declared (else potential build error)
Summary: sysutils/bsdisks: ensure uid_t is declared (else potential build error)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Gleb Popov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-03 16:35 UTC by John Hein
Modified: 2023-12-03 16:47 UTC (History)
0 users

See Also:
arrowd: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2023-12-03 16:35:35 UTC
sysutils/bsdisks is failing to compile on 12.x

blockfilesystem.h should include sys/types.h as it references uid_t.

It's luck that it compiles on 13.x (due to the way system include files just happen to be written).

POSIX states that uid_t is defined in sys/types.h
Look for uid_t in these references:

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pwd.h.html

As it turns out changes to sched.h resulted in getting uid_t defined for blockfilesystem.h on 13.x


compile error:

FAILED: CMakeFiles/bsdisks.dir/blockfilesystem.cpp.o
/usr/bin/c++ -DINSTALL_PREFIX=\"/usr/local\" -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_NO_DEBUG -I/usr/ports/sysutils/bsdisks/work/.build -I/usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d -I/usr/ports/sysutils/bsdisks/work/.build/bsdisks_autogen/include -isystem /usr/local/include/qt5 -isystem /usr/local/include/qt5/QtDBus -isystem /usr/local/include/qt5/QtCore -isystem /usr/local/lib/qt5/mkspecs/freebsd-clang -isystem /usr/local/include/polkit-qt5-1 -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing   -DNDEBUG -std=gnu++17 -fPIC -pthread -MD -MT CMakeFiles/bsdisks.dir/blockfilesystem.cpp.o -MF CMakeFiles/bsdisks.dir/blockfilesystem.cpp.o.d -o CMakeFiles/bsdisks.dir/blockfilesystem.cpp.o -c /usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d/blockfilesystem.cpp
In file included from /usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d/blockfilesystem.cpp:30:
/usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d/blockfilesystem.h:54:29: error: use of undeclared identifier 'uid_t'
    QList<QPair<QByteArray, uid_t>> mountPoints;
                            ^
/usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d/blockfilesystem.h:60:56: error: use of undeclared identifier 'uid_t'
    void unmountImplementation(QList<QPair<QByteArray, uid_t>>::iterator it, bool force, bool changed, std::shared_ptr<DBusSavedContext> context);
                                                       ^
/usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d/blockfilesystem.cpp:218:23: error: out-of-line definition of 'unmountImplementation' does not match any declaration in 'BlockFilesystem'
void BlockFilesystem::unmountImplementation(QList<QPair<QByteArray, uid_t>>::iterator it, bool force, bool changed, std::shared_ptr<DBusSavedContext> context)
                      ^~~~~~~~~~~~~~~~~~~~~
/usr/ports/sysutils/bsdisks/work/bsdisks-7472fc29bafb5cf44c539131d566fbe541b7fd7d/blockfilesystem.cpp:380:33: error: cannot initialize object parameter of type 'const QObject' with an expression of type 'BlockFilesystem'
    return qobject_cast<Block*>(parent());
                                ^~~~~~
4 errors generated.
ninja: build stopped: subcommand failed.
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2023-12-03 16:36:26 UTC
FreeBSD 12 goes EoL in 2 days, so I don't want to bother with this fix.
Comment 2 Gleb Popov freebsd_committer freebsd_triage 2023-12-03 16:37:17 UTC
But now I read you reasoning, I guess it is still a right thing to do
Comment 3 John Hein 2023-12-03 16:40:16 UTC
(In reply to Gleb Popov from comment #2)
Yeah, it seems most correct to include sys/types.h in blockfilesystem.h (not just because it happens to fail on 12.x)
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-12-03 16:44:57 UTC
A commit in branch main references this bug:

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

commit 1f1bf812eb2bb5b2ad37702fd6b046c2df9101dd
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2023-12-03 16:43:36 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2023-12-03 16:44:06 +0000

    sysutils/bsdisks: Update to 0.33

    PR:             275508

 sysutils/bsdisks/Makefile | 4 ++--
 sysutils/bsdisks/distinfo | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
Comment 5 John Hein 2023-12-03 16:45:24 UTC
(In reply to Gleb Popov from comment #2)
Thanks for taking a look.  I see you already committed upstream.

I haven't delved into the warnings yet.  I will (later) if no one beats me to it.
Comment 6 Gleb Popov freebsd_committer freebsd_triage 2023-12-03 16:47:00 UTC
(In reply to John Hein from comment #5)
And thank you for the standards writeup. I was aware of the build failure but was reluctant to fix it only for the sake of FreeBSD 12. But conforming to standards is much more important thing.