Tested under Windows 11, macOS Golden Gate, and Linux Mint.
https://github.com/wxWidgets/wxWidgets/pull/27201
(3 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@vadz requested changes on this pull request.
This opens a can of worms because I'm not sure it's a good idea to represent an account as just wxString. The first problem with this is that under Unix it's really an UID and there may not be any associated string (which is perfectly normal when copying files from a different system using different UIDs and reporting error for it is not a good idea). The second one is that under Windows accounts have hierarchy.
So I'd think about adding wxLocalAccount or something like this with appropriate functions to retrieve its contents.
> + }
+
+ ::LocalFree(secDesc);
+
+ if ( !owner.empty() )
+ return owner;
+ }
+#elif defined(wxHAVE_LSTAT)
+ wxStructStat stBuf;
+ if ( StatAny(stBuf, *this) )
+ {
+ struct passwd pwd;
+ struct passwd* result = nullptr;
+ std::vector<char> buf(1024);
+ int rc;
+ while ( (rc = getpwuid_r(stBuf.st_uid, &pwd, buf.data(), buf.size(),
We're supposed to use #ifdef HAVE_GETPWUID_R around this function although I don't know if there are still any systems not providing it in current use.
Also, and maybe more importantly, we should provide a wrapper for it as this is different from what the existing code in src/common/tarstrm.cpp does (notably this always uses UTF-8 which is not correct if locale is not UTF-8).
> + }
+#elif defined(wxHAVE_LSTAT)
+ wxStructStat stBuf;
+ if ( StatAny(stBuf, *this) )
+ {
+ struct passwd pwd;
+ struct passwd* result = nullptr;
+ std::vector<char> buf(1024);
+ int rc;
+ while ( (rc = getpwuid_r(stBuf.st_uid, &pwd, buf.data(), buf.size(),
+ &result)) == ERANGE )
+ {
+ buf.resize(buf.size() * 2);
+ }
+
+ if ( rc == 0 && result != nullptr )
We may want to return the numeric UID if we failed to find the name.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I'm taking a swing at wxLocalAccount now, will update here later...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@Blake-Madden commented on this pull request.
> + }
+
+ ::LocalFree(secDesc);
+
+ if ( !owner.empty() )
+ return owner;
+ }
+#elif defined(wxHAVE_LSTAT)
+ wxStructStat stBuf;
+ if ( StatAny(stBuf, *this) )
+ {
+ struct passwd pwd;
+ struct passwd* result = nullptr;
+ std::vector<char> buf(1024);
+ int rc;
+ while ( (rc = getpwuid_r(stBuf.st_uid, &pwd, buf.data(), buf.size(),
done
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
> + }
+#elif defined(wxHAVE_LSTAT)
+ wxStructStat stBuf;
+ if ( StatAny(stBuf, *this) )
+ {
+ struct passwd pwd;
+ struct passwd* result = nullptr;
+ std::vector<char> buf(1024);
+ int rc;
+ while ( (rc = getpwuid_r(stBuf.st_uid, &pwd, buf.data(), buf.size(),
+ &result)) == ERANGE )
+ {
+ buf.resize(buf.size() * 2);
+ }
+
+ if ( rc == 0 && result != nullptr )
Implemented wxLocalAccount, which includes UI and domain (MSW), along with the name.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@Blake-Madden pushed 2 commits.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@vadz commented on this pull request.
Thanks, this looks mostly good now, but I think we should apply it to master after branching 3.4 as I'd like to stop adding features to 3.4 to avoid introducing any problems after 3.3.4.
> @@ -127,6 +127,49 @@ extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize; +// ---------------------------------------------------------------------------- +// wxLocalAccount: identifies a user or group account of the local system
This probably belongs in its own header, as it could be useful elsewhere.
> @@ -127,6 +127,49 @@ extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize;
+// ----------------------------------------------------------------------------
+// wxLocalAccount: identifies a user or group account of the local system
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxLocalAccount
+{
+public:
+ // Creates an invalid account object.
+ wxLocalAccount() = default;
+
As this seems to be copyable, better make it explicit with
wxLocalAccount(const wxLocalAccount&) = default; wxLocalAccount& operator=(const wxLocalAccount&) = default;
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@Blake-Madden commented on this pull request.
> @@ -127,6 +127,49 @@ extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize;
+// ----------------------------------------------------------------------------
+// wxLocalAccount: identifies a user or group account of the local system
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_BASE wxLocalAccount
+{
+public:
+ // Creates an invalid account object.
+ wxLocalAccount() = default;
+
done.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@Blake-Madden commented on this pull request.
> @@ -127,6 +127,49 @@ extern WXDLLIMPEXP_DATA_BASE(const wxULongLong) wxInvalidSize; +// ---------------------------------------------------------------------------- +// wxLocalAccount: identifies a user or group account of the local system
done
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@Blake-Madden pushed 2 commits.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@lanurmi commented on this pull request.
> +// Copyright: (c) 2026 Blake Madden +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_LOCALACCOUNT_H_ +#define _WX_LOCALACCOUNT_H_ + +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_BASE wxFileName; + +// ---------------------------------------------------------------------------- +// wxLocalAccount: identifies a user account of the local system +// ---------------------------------------------------------------------------- + +class WXDLLIMPEXP_BASE wxLocalAccount⬇️ Suggested change
-class WXDLLIMPEXP_BASE wxLocalAccount +class WXDLLIMPEXP_BASE wxWARN_UNUSED wxLocalAccount
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@Blake-Madden pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()