Bug 115142 - Permit ~/Library to be a symlink
Summary: Permit ~/Library to be a symlink
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-04-24 17:57 PDT by Simon Cooper
Modified: 2013-04-26 15:21 PDT (History)
2 users (show)

See Also:


Attachments
Patch (15.06 KB, patch)
2013-04-24 18:02 PDT, Simon Cooper
no flags Details | Formatted Diff | Diff
Patch (16.19 KB, patch)
2013-04-26 14:31 PDT, Simon Cooper
ap: review+
ap: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Cooper 2013-04-24 17:57:12 PDT
Permit ~/Library to be a symlink
Comment 1 Simon Cooper 2013-04-24 18:02:24 PDT
Created attachment 199570 [details]
Patch
Comment 2 Alexey Proskuryakov 2013-04-25 09:43:18 PDT
Comment on attachment 199570 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=199570&action=review

Looks good to me, with a question about pwd.pw_dir encoding below.

Note however that this behavior doesn't quite match AppSandbox, which also allows ~/Library/Preferences to be a symlink.

> Source/WebKit2/Resources/PlugInSandboxProfiles/com.apple.WebKit.plugin-common.sb:18
> +(define (home-library-regex home-library-relative-regex)
> +  (regex (string-append "^" (regex-quote (param "HOME_LIBRARY_DIR")) home-library-relative-regex)))

Indentation should be 4 characters here, too.

> Source/WebKit2/Shared/mac/ChildProcessMac.mm:142
> +    String libraryPath = String(pwd.pw_dir);

This constructor treats the input as Latin-1. Is this correct, or should it be UTF-8? In the latter case, String::fromUTF8() is the right way to create the String object.
Comment 3 Simon Cooper 2013-04-26 14:31:14 PDT
Created attachment 199861 [details]
Patch
Comment 4 Simon Cooper 2013-04-26 15:06:17 PDT
Updated the patch to support both ~/Library and ~/Library/Preferences.

Made sure that a home directory containing unicode makes it to the Sandboxing without being mangled.
Comment 5 Alexey Proskuryakov 2013-04-26 15:12:59 PDT
Comment on attachment 199861 [details]
Patch

Commit queue won't land this patch because of spaces. I'll land manually.
Comment 6 Alexey Proskuryakov 2013-04-26 15:21:58 PDT
Committed <http://trac.webkit.org/r149217>.