WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
219993
$(findstring iphone,$(SDKROOT)) fails when SDKROOT is not lowercase
https://bugs.webkit.org/show_bug.cgi?id=219993
Summary
$(findstring iphone,$(SDKROOT)) fails when SDKROOT is not lowercase
Ryan Hostetler
Reported
2020-12-17 12:38:25 PST
rdar://72436093
In our makefiles checks SDKROOT are case sensitive and fail if the SDKROOT has uppercase. EG: $(findstring iphone,$(SDKROOT)) fails with SDKs cased as iPhoneOS. This patch converts SDKROOT path to lowercase so any casing is matched in the same way.
Attachments
Patch
(6.11 KB, patch)
2020-12-17 12:45 PST
,
Ryan Hostetler
no flags
Details
Formatted Diff
Diff
Patch
(6.30 KB, patch)
2020-12-17 14:22 PST
,
Ryan Hostetler
no flags
Details
Formatted Diff
Diff
Patch
(6.30 KB, patch)
2020-12-17 15:35 PST
,
Ryan Hostetler
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ryan Hostetler
Comment 1
2020-12-17 12:45:03 PST
Created
attachment 416453
[details]
Patch
Darin Adler
Comment 2
2020-12-17 12:54:42 PST
Is there any user controlled directory name that can be in the SDKROOT path? What if the volume name contains the letter "iPhone", "TV", or "macOS" in them?
Ryan Hostetler
Comment 3
2020-12-17 13:11:45 PST
(In reply to Darin Adler from
comment #2
)
> Is there any user controlled directory name that can be in the SDKROOT path? > What if the volume name contains the letter "iPhone", "TV", or "macOS" in > them?
The default SDKROOT path lives within the Xcode directory eg: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk The most likely problem would arise from a renamed Xcode eg: `Xcode-iphone.app`, which is still a risk without this patch. If we wanted to protect further we could use match against `sdks/iphone`, though I'm not sure if there are use cases where the SDK would be moved out of the `SDKs` path.
Darin Adler
Comment 4
2020-12-17 13:47:11 PST
(In reply to Ryan Hostetler from
comment #3
)
> The default SDKROOT path lives within the Xcode directory eg: > /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/ > Developer/SDKs/iPhoneOS13.0.sdk > > The most likely problem would arise from a renamed Xcode eg: > `Xcode-iphone.app`, which is still a risk without this patch.
Or an Xcode someone put into a directory like "/Users/darin/iPhoneTools". And, yes, I was not suggesting it’s new in this patch, although doing case folding makes it even more likely to get it wrong.
> If we wanted to protect further we could use match against `sdks/iphone`, > though I'm not sure if there are use cases where the SDK would be moved out > of the `SDKs` path.
Sure, or even "platform/developer/sdks/iphone". Not sure what’s best.
Darin Adler
Comment 5
2020-12-17 13:48:35 PST
Or use something that extracts only the last piece of the SDKROOT path. There must be a function for that, maybe "basename".
Ryan Hostetler
Comment 6
2020-12-17 14:13:23 PST
(In reply to Darin Adler from
comment #5
)
> Or use something that extracts only the last piece of the SDKROOT path. > There must be a function for that, maybe "basename".
Looks like notdir will grab just the SDK name: $(notdir $(call to_lower,$(SDKROOT)))
> iphoneos13.0.sdk
Ryan Hostetler
Comment 7
2020-12-17 14:22:46 PST
Created
attachment 416470
[details]
Patch
Darin Adler
Comment 8
2020-12-17 15:17:35 PST
Comment on
attachment 416470
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=416470&action=review
> Source/Makefile:6 > + ifneq (,$(findstring macosx,$(notdir $(call to_lower,$(SDKROOT)))))
I think it would be better to call notdir first before calling shell, so we pass a shorter string. Not sure why we used all lowercase for "to_lower" when we use all uppercase for other make variables.
Ryan Hostetler
Comment 9
2020-12-17 15:35:36 PST
Created
attachment 416476
[details]
Patch
Ryan Haddad
Comment 10
2020-12-21 12:41:16 PST
rdar://72436093
EWS
Comment 11
2020-12-21 12:46:35 PST
Committed
r271037
: <
https://trac.webkit.org/changeset/271037
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 416476
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug