WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 184166
181309
Sandbox preprocessing should handle C++ comments
https://bugs.webkit.org/show_bug.cgi?id=181309
Summary
Sandbox preprocessing should handle C++ comments
Brent Fulgham
Reported
2018-01-04 14:54:38 PST
The text preprocessing rules in WebKit's DerivedSources.make is now only used for processing our sandbox profiles. Sometimes the headers and availability macros included on macOS and iOS SDK's have spurious C++-style comments in them, which are not stripped out during preprocessing since we were telling clang to use C89 rules for preprocessing. Instead, we should switch to C99 so that C++-style comments will get properly ignored, and we won't confuse the Sandbox library when it tries the read the finished file.
Attachments
Patch
(1.60 KB, patch)
2018-01-04 15:02 PST
,
Brent Fulgham
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-01-04 14:59:33 PST
<
rdar://problem/36306874
>
Brent Fulgham
Comment 2
2018-01-04 15:02:03 PST
Created
attachment 330490
[details]
Patch
Alexey Proskuryakov
Comment 3
2018-01-04 16:16:54 PST
Comment on
attachment 330490
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=330490&action=review
> Source/WebKit/ChangeLog:9 > + Switch to C99 rules for preprocessing our sandbox profiles. No other code uses the TEXT_PREPROCESSOR_FLAGS
Can you diff processed profiles? This seems likely to break all comments with "rdar://" in them. Theoretically, it can break actual rules if they have double slashes, but we don't have any like that now.
Brent Fulgham
Comment 4
2018-01-04 16:25:27 PST
Comment on
attachment 330490
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=330490&action=review
>> Source/WebKit/ChangeLog:9 >> + Switch to C99 rules for preprocessing our sandbox profiles. No other code uses the TEXT_PREPROCESSOR_FLAGS > > Can you diff processed profiles? This seems likely to break all comments with "rdar://" in them. Theoretically, it can break actual rules if they have double slashes, but we don't have any like that now.
Yes -- it definitely cuts off everything after the "//" in the comment, so maybe we don't want to do that. We should probably create a WebKit-specific filter program that does exactly what we want.
Darin Adler
Comment 5
2018-01-07 22:56:44 PST
Comment on
attachment 330490
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=330490&action=review
>>> Source/WebKit/ChangeLog:9 >>> + Switch to C99 rules for preprocessing our sandbox profiles. No other code uses the TEXT_PREPROCESSOR_FLAGS >> >> Can you diff processed profiles? This seems likely to break all comments with "rdar://" in them. Theoretically, it can break actual rules if they have double slashes, but we don't have any like that now. > > Yes -- it definitely cuts off everything after the "//" in the comment, so maybe we don't want to do that. > > We should probably create a WebKit-specific filter program that does exactly what we want.
No, I don’t think this will break /* */ comments with // inside them. Those work fine in C++; why wouldn’t clang handle that properly? Actual rules with double slashes is something different, though. Maybe that’s important?
Alexey Proskuryakov
Comment 6
2018-01-08 09:35:04 PST
The comments in .sb.in files are of this form: ; "com.apple.coremedia.endpointpicker.xpc" can be removed when <
rdar://problem/30081582
> is resolved. And with this patch, the built .sb file has lines like this: ; "com.apple.coremedia.endpointpicker.xpc" can be removed when <rdar: I don't think that it's particularly important to preserve comments in sandbox profiles, so maybe the solution is to switch from ";" to "//" for comments. The only downside will be that comments will be inconsistent between processed and non-processed sandbox profile sources (e.g. Source/WebKit/NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in vs. Source/WebKit/Resources/SandboxProfiles/ios/com.apple.WebKit.Networking.sb). And yes, rules with double slashes are probably not important. If one is ever introduced, this will almost certainly break profile compilation, so bots will quickly tell us about the problem.
Alexey Proskuryakov
Comment 7
2018-03-31 23:03:08 PDT
*** This bug has been marked as a duplicate of
bug 184166
***
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