-
Notifications
You must be signed in to change notification settings - Fork 867
Use USER env var instead of LOGNAME #1559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
During user switch with su/sudo in system LOGNAME may not be initialised, but USER env var is always exist.
| let projectGenerator = ProjectGenerator(project: project) | ||
|
|
||
| guard let userName = ProcessInfo.processInfo.environment["LOGNAME"] else { | ||
| guard let userName = ProcessInfo.processInfo.environment["USER"] else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't my area of expertise. Would this cover all bases?
| guard let userName = ProcessInfo.processInfo.environment["USER"] else { | |
| let environment = ProcessInfo.processInfo.environment | |
| guard let userName = environment["USER"] ?? environment["LOGNAME"] ?? NSUserName() else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think USER always exists it's standart *nix variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw error is named GenerationError.missingUsername not GenerationError.missingLogname
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the goal of this check at all? Is it passed only for file owner for created files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used to generate XCUserData
* Custom error handler * Check for error reason and expected type * Improvements * Update CHANGELOG.md * Update master (#1) * Update CI equipments and drop Xcode 15 support (#1548) * Add validation to ensure that settings.configs values are dictionaries, in order to prevent misuse (#1547) * Add validation to ensure settings.configs values are dictionaries to prevent misuse * Add tests for invalid settings.configs value formats * Replaced with filter and split into a function * Rename invalidConfigsFormat to invalidConfigsMappingFormat * Add comments to explain invalid fixture * Rename test fixture * Update CHANGELOG.md * Correct grammer * Use KeyPath instead of closure * Rename validateMappingStyleInConfig to extractValidConfigs * Add a document comment for extractValidConfigs(from:) * Use old testing api and remove EquatableErrorBox * Rename test case to use "mapping" instead of "dictionary" * Add ValidSettingsExtractor to encapsulate the logic for converting a dictionary to Settings * Add settings validation for both Target and AggregateTarget * Add tests for invalid settings.configs in Target and AggregateTarget * Add document comments for ValidSettingsExtractor * Rename ValidSettingsExtractor to BuildSettingsExtractor * Add settings validation for settingGroups * Add tests for settingGroups * Rename extract to parse * Refactor * Update Tests/ProjectSpecTests/InvalidConfigsFormatTests.swift --------- Co-authored-by: Yonas Kolb <[email protected]> * Synced folders (#1541) * update xcodeproj to 8.27.7 * add syncedFolder source type * drop xcode 15 support * Rely on fileReference instead of adding new synchronizedRootGroup (#1557) * fix: don't include untracked children in cache --------- Co-authored-by: Kirill Yakimovich <[email protected]> * Use USER env var instead of LOGNAME (#1559) During user switch with su/sudo in system LOGNAME may not be initialised, but USER env var is always exist. * Address Sanitizer options in run/test schemes (#1550) * Expose address sanitizer flags in run and test BuildActions in Schemes * Update testJSONEncodable to test the new fields * Also test the asan setting values for run scheme * Update changelog --------- Co-authored-by: Yonas Kolb <[email protected]> * Update to 2.44.0 # Conflicts: # CHANGELOG.md --------- Co-authored-by: Kohki Miki <[email protected]> Co-authored-by: Ryu <[email protected]> Co-authored-by: Yonas Kolb <[email protected]> Co-authored-by: Kirill Yakimovich <[email protected]> Co-authored-by: Kanstantsin Shautsou <[email protected]> Co-authored-by: Himanshu Kumar <[email protected]> * Revert * Refactoring started * func json(atKeyPath keyPath: String) -> String? * All cases --------- Co-authored-by: Kohki Miki <[email protected]> Co-authored-by: Ryu <[email protected]> Co-authored-by: Yonas Kolb <[email protected]> Co-authored-by: Kirill Yakimovich <[email protected]> Co-authored-by: Kanstantsin Shautsou <[email protected]> Co-authored-by: Himanshu Kumar <[email protected]>
During user switch with su/sudo in system LOGNAME may not be initialised, but USER env var is always exist.