Skip to content

Conversation

@KostyaSha
Copy link
Contributor

During user switch with su/sudo in system LOGNAME may not be initialised, but USER env var is always exist.

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 {
Copy link
Owner

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?

Suggested change
guard let userName = ProcessInfo.processInfo.environment["USER"] else {
let environment = ProcessInfo.processInfo.environment
guard let userName = environment["USER"] ?? environment["LOGNAME"] ?? NSUserName() else {

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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?

Copy link
Owner

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

@yonaskolb yonaskolb merged commit 38d76e7 into yonaskolb:master Jul 17, 2025
3 checks passed
yonaskolb added a commit that referenced this pull request Jul 22, 2025
* 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]>
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.

2 participants