Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Issue 66043003: Put app shim IPC socket in a temporary directory. (Mac) (Closed)

Created:
7 years, 1 month ago by jackhou1
Modified:
6 years, 10 months ago
CC:
chromium-reviews, chrome-apps-syd-reviews_chromium.org, tfarina, chromium-apps-reviews_chromium.org
Visibility:
Public.

Description

Put app shim IPC socket in a temporary directory. (Mac) The path to the App Shim Socket must be less than 104 characters. Since the socket is inside the user data dir, the path is frequently too long in tests. It is also very likely to be too long for any users that have a long username. In this CL, the socket is always placed at: "<DIR_TEMP>/XXXXXX/App Shim Socket" where XXXXXX is replaced with a random suffix by mkdtemp. A symlink to the socket is placed in "<udd>/App Shim Socket" (the old socket path). The shim reads this symlink to find the actual socket. BUG=240554 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=250051

Patch Set 1 #

Patch Set 2 : Always use short socket path #

Total comments: 22

Patch Set 3 : Change to /tmp/chrome-<hash of udd>/App Shim Socket #

Total comments: 12

Patch Set 4 : Address comments #

Total comments: 4

Patch Set 5 : Delete folder unconditionally. #

Patch Set 6 : Use PostTask to delete file. #

Total comments: 4

Patch Set 7 : Sync and rebase #

Patch Set 8 : Address comments #

Total comments: 6

Patch Set 9 : Sync and rebase #

Patch Set 10 : Sync and rebase #

Patch Set 11 : Always delete directory in tmp, and create with mkdtemp #

Patch Set 12 : should_try_long_socket_path_ #

Patch Set 13 : Put App Shim Socket in "/tmp/chrome-<hash of UDD>/", make a symlink to it at "<UDD>/App Shim Socket… #

Total comments: 32

Patch Set 14 : Address comments #

Total comments: 5

Patch Set 15 : Add test, update comments. #

Patch Set 16 : Sync and rebase #

Total comments: 2

Patch Set 17 : Sync and rebase #

Patch Set 18 : Use PathService(DIR_TEMP) instead of "/tmp" #

Total comments: 8

Patch Set 19 : Address comments #

Patch Set 20 : Sync, rebase, git cl format #

Unified diffs Side-by-side diffs Delta from patch set Stats (+170 lines, -92 lines) Patch
M apps/app_shim/app_shim_host_manager_browsertest_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 8 chunks +50 lines, -51 lines 0 comments Download
M apps/app_shim/app_shim_host_manager_mac.h View 1 2 3 4 1 chunk +1 line, -2 lines 0 comments Download
M apps/app_shim/app_shim_host_manager_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +61 lines, -16 lines 0 comments Download
M apps/app_shim/chrome_main_app_mode_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 5 chunks +31 lines, -10 lines 0 comments Download
M apps/app_shim/test/app_shim_host_manager_test_api_mac.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -2 lines 0 comments Download
M apps/app_shim/test/app_shim_host_manager_test_api_mac.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +4 lines, -8 lines 0 comments Download
M chrome/common/mac/app_mode_common.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +9 lines, -2 lines 0 comments Download
M chrome/common/mac/app_mode_common.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +12 lines, -1 line 0 comments Download

Messages

Total messages: 45 (0 generated)
jackhou1
I've tested that this works. I.e. running a version of chromium built without this CL, ...
7 years, 1 month ago (2013-11-20 23:55:32 UTC) #1
tapted
Nice - I really like that you're getting rid of the specialised testing code. We'll ...
7 years, 1 month ago (2013-11-21 11:12:04 UTC) #2
jackhou1
https://codereview.chromium.org/66043003/diff/30001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm File apps/app_shim/app_shim_host_manager_browsertest_mac.mm (right): https://codereview.chromium.org/66043003/diff/30001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm#newcode58 apps/app_shim/app_shim_host_manager_browsertest_mac.mm:58: PathService::Get(chrome::DIR_USER_DATA, &socket_path); On 2013/11/21 11:12:05, tapted wrote: > nit: ...
7 years, 1 month ago (2013-11-22 00:20:39 UTC) #3
tapted
https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm#newcode52 apps/app_shim/app_shim_host_manager_mac.mm:52: // (IPC::kMaxSocketNameLength). To circumvent this, we use a short ...
7 years, 1 month ago (2013-11-22 03:29:43 UTC) #4
jackhou1
https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm#newcode52 apps/app_shim/app_shim_host_manager_mac.mm:52: // (IPC::kMaxSocketNameLength). To circumvent this, we use a short ...
7 years, 1 month ago (2013-11-22 04:25:00 UTC) #5
tapted
https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm#newcode59 apps/app_shim/app_shim_host_manager_mac.mm:59: if (!file_util::CreateDirectory(socket_path.DirName())) On 2013/11/22 04:25:00, jackhou1 wrote: > On ...
7 years, 1 month ago (2013-11-22 05:04:30 UTC) #6
jackhou1
https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/120001/apps/app_shim/app_shim_host_manager_mac.mm#newcode59 apps/app_shim/app_shim_host_manager_mac.mm:59: if (!file_util::CreateDirectory(socket_path.DirName())) On 2013/11/22 05:04:31, tapted wrote: > On ...
7 years, 1 month ago (2013-11-22 05:51:02 UTC) #7
tapted
lgtm, but we should get some security eyes on it https://codereview.chromium.org/66043003/diff/310001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/310001/apps/app_shim/app_shim_host_manager_mac.mm#newcode64 ...
7 years, 1 month ago (2013-11-22 06:50:42 UTC) #8
jackhou1
https://codereview.chromium.org/66043003/diff/310001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/310001/apps/app_shim/app_shim_host_manager_mac.mm#newcode64 apps/app_shim/app_shim_host_manager_mac.mm:64: directory_in_tmp_ = socket_path.DirName(); On 2013/11/22 06:50:43, tapted wrote: > ...
7 years ago (2013-12-09 05:47:45 UTC) #9
jackhou1
palmer, could you please do security review
7 years ago (2013-12-09 05:53:16 UTC) #10
palmer
https://codereview.chromium.org/66043003/diff/390001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/390001/apps/app_shim/app_shim_host_manager_mac.mm#newcode31 apps/app_shim/app_shim_host_manager_mac.mm:31: base::DeleteFile(path, true); Might this follow symlinks? https://codereview.chromium.org/66043003/diff/390001/apps/app_shim/chrome_main_app_mode_mac.mm File apps/app_shim/chrome_main_app_mode_mac.mm ...
7 years ago (2013-12-10 20:04:22 UTC) #11
palmer
I tried to apply this diff locally against a fresh ToT tree, and I get: ...
7 years ago (2013-12-10 20:23:09 UTC) #12
jackhou1
On 2013/12/10 20:23:09, Chromium Palmer wrote: > I tried to apply this diff locally against ...
7 years ago (2013-12-11 00:22:42 UTC) #13
palmer
Thanks for the rebase; works now. This does not LGTM yet, but there's a standard ...
7 years ago (2013-12-12 21:59:06 UTC) #14
palmer
> I suggest using > https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/mkdtemp.3.html: > Use mkdtemp with an appropriate name template. Oops, ...
7 years ago (2013-12-12 22:02:49 UTC) #15
jackhou1
On 2013/12/12 22:02:49, Chromium Palmer wrote: > > I suggest using > > > https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/mkdtemp.3.html: ...
7 years ago (2013-12-13 05:32:59 UTC) #16
palmer
So, the goal is to create a path shorter than 128 characters, and we've found ...
7 years ago (2013-12-17 19:55:23 UTC) #17
palmer
So, the goal is to create a path shorter than 128 characters, and we've found ...
7 years ago (2013-12-17 19:55:24 UTC) #18
palmer
Here's jln, CC'd. I forgot to mention this in my previous comment: I'd really like ...
7 years ago (2013-12-17 19:56:22 UTC) #19
tapted
Just to add some extra tidbits I've collected along the way (don't really have a ...
7 years ago (2013-12-18 00:55:04 UTC) #20
jackhou1
I don't think it's possible to use mkstemp to create a socket. bind(2) fails if ...
7 years ago (2013-12-20 02:33:39 UTC) #21
palmer
Well, let's go with requiring mkdtemp to succeed (or to have succeeded and then ensuring ...
6 years, 11 months ago (2013-12-30 23:43:23 UTC) #22
jackhou1
tapted, PTAL
6 years, 11 months ago (2014-01-03 06:41:48 UTC) #23
tapted
Make sure you update the CL description. Also, there might be some comments from palmer@ ...
6 years, 11 months ago (2014-01-03 13:06:53 UTC) #24
jackhou1
tapted, PTAL palmer, sorry I missed some comments from earlier, added replies here. https://codereview.chromium.org/66043003/diff/390001/apps/app_shim/app_shim_host_manager_mac.mm File ...
6 years, 11 months ago (2014-01-06 05:29:51 UTC) #25
tapted
https://codereview.chromium.org/66043003/diff/520001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm File apps/app_shim/app_shim_host_manager_browsertest_mac.mm (right): https://codereview.chromium.org/66043003/diff/520001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm#newcode243 apps/app_shim/app_shim_host_manager_browsertest_mac.mm:243: // Test that existing symlinks are deleted. On 2014/01/06 ...
6 years, 11 months ago (2014-01-06 07:31:27 UTC) #26
jackhou1
https://codereview.chromium.org/66043003/diff/520001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm File apps/app_shim/app_shim_host_manager_browsertest_mac.mm (right): https://codereview.chromium.org/66043003/diff/520001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm#newcode243 apps/app_shim/app_shim_host_manager_browsertest_mac.mm:243: // Test that existing symlinks are deleted. On 2014/01/06 ...
6 years, 11 months ago (2014-01-07 05:24:35 UTC) #27
tapted
nice - lgtm (% any concerns the security folks might raise)
6 years, 11 months ago (2014-01-07 05:50:22 UTC) #28
jackhou1
palmer, PTAL
6 years, 11 months ago (2014-01-07 06:05:09 UTC) #29
jackhou1
Ping.
6 years, 11 months ago (2014-01-14 03:14:55 UTC) #30
jackhou1
On 2014/01/14 03:14:55, jackhou1 wrote: > Ping. Oops, I forgot to address some comments jln ...
6 years, 11 months ago (2014-01-14 06:12:35 UTC) #31
jln (very slow on Chromium)
On 2014/01/14 06:12:35, jackhou1 wrote: > On 2014/01/14 03:14:55, jackhou1 wrote: > > Ping. > ...
6 years, 11 months ago (2014-01-14 22:09:03 UTC) #32
palmer
> It looks like you're using mkdtemp, so indeed you're fine. mkdtemp uses O_EXCL | ...
6 years, 11 months ago (2014-01-24 03:07:34 UTC) #33
jln (very slow on Chromium)
On 2014/01/24 03:07:34, Chromium Palmer wrote: > > It looks like you're using mkdtemp, so ...
6 years, 11 months ago (2014-01-24 03:38:05 UTC) #34
jackhou1
Thanks for the reviews!
6 years, 11 months ago (2014-01-24 05:19:36 UTC) #35
jackhou1
thakis, please review for OWNERS in chrome/common/mac/
6 years, 11 months ago (2014-01-24 05:20:19 UTC) #36
Nico
https://codereview.chromium.org/66043003/diff/860001/apps/app_shim/app_shim_host_manager_mac.mm File apps/app_shim/app_shim_host_manager_mac.mm (right): https://codereview.chromium.org/66043003/diff/860001/apps/app_shim/app_shim_host_manager_mac.mm#newcode39 apps/app_shim/app_shim_host_manager_mac.mm:39: return base::FilePath("/tmp").Append("chrome-" + udd_hash + ".XXXXXX"); This doesn't lgtm. ...
6 years, 11 months ago (2014-01-24 16:49:17 UTC) #37
jackhou1
tapted, thakis, PTAL It seems fine to use PathService(DIR_TEMP) instead of /tmp. The temp directory ...
6 years, 10 months ago (2014-01-31 05:01:15 UTC) #38
tapted
https://codereview.chromium.org/66043003/diff/990001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm File apps/app_shim/app_shim_host_manager_browsertest_mac.mm (right): https://codereview.chromium.org/66043003/diff/990001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm#newcode241 apps/app_shim/app_shim_host_manager_browsertest_mac.mm:241: EXPECT_TRUE(base::CreateSymbolicLink(base::FilePath("/tmp"), symlink_path_)); does this need to be updated? https://codereview.chromium.org/66043003/diff/990001/apps/app_shim/app_shim_host_manager_mac.mm ...
6 years, 10 months ago (2014-01-31 07:04:11 UTC) #39
jackhou1
https://codereview.chromium.org/66043003/diff/990001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm File apps/app_shim/app_shim_host_manager_browsertest_mac.mm (right): https://codereview.chromium.org/66043003/diff/990001/apps/app_shim/app_shim_host_manager_browsertest_mac.mm#newcode241 apps/app_shim/app_shim_host_manager_browsertest_mac.mm:241: EXPECT_TRUE(base::CreateSymbolicLink(base::FilePath("/tmp"), symlink_path_)); On 2014/01/31 07:04:12, tapted wrote: > does ...
6 years, 10 months ago (2014-01-31 07:19:20 UTC) #40
tapted
lgtm although i'm uncertain of what the behaviour should be if `PathService::Get(base::DIR_TEMP` actually fails. Most ...
6 years, 10 months ago (2014-01-31 08:58:17 UTC) #41
Nico
lgtm On 2014/01/31 08:58:17, tapted wrote: > lgtm although i'm uncertain of what the behaviour ...
6 years, 10 months ago (2014-02-03 20:17:44 UTC) #42
jackhou1
The CQ bit was checked by jackhou@chromium.org
6 years, 10 months ago (2014-02-10 03:45:01 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jackhou@chromium.org/66043003/1060001
6 years, 10 months ago (2014-02-10 03:45:15 UTC) #44
commit-bot: I haz the power
6 years, 10 months ago (2014-02-10 05:27:48 UTC) #45
Message was sent while issue was closed.
Change committed as 250051

Powered by Google App Engine
This is Rietveld 408576698