Adar Dembo has posted comments on this change.

Change subject: env_util: Implement CreateDirsRecursively()
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/5618/2/src/kudu/util/env_util.cc
File src/kudu/util/env_util.cc:

Line 200:     if (s.ok() && is_dir) continue;
If you're aiming for mkdir -p semantics, it should be ok for one of the path 
components to be a valid symlink to a directory. I don't think this 
implementation satisfies that.

Here's an example of what mkdir will do:
  adar@adar-ThinkPad-T540p:/tmp$ ls -dl a b
  drwxrwxr-x 3 adar adar 4096 Jan  5 17:35 a
  lrwxrwxrwx 1 adar adar    1 Jan  5 17:34 b -> a
  adar@adar-ThinkPad-T540p:/tmp$ strace mkdir -p b/c/d
  ...
  mkdir("b", 0777)                        = -1 EEXIST (File exists)
  chdir("b")                              = 0
  mkdir("c", 0777)                        = 0
  open("c", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_NOFOLLOW) = 3
  fchdir(3)                               = 0
  close(3)                                = 0
  mkdir("d", 0777)                        = 0
  ...

Not sure why it uses open/fchdir for 'c' instead of just chdir; maybe that's to 
avoid a TOCTOU race that we may not care about.


-- 
To view, visit http://gerrit.cloudera.org:8080/5618
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia664708a09493923abbf2ff4e56e3d49c62cf97e
Gerrit-PatchSet: 2
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-Owner: Mike Percy <[email protected]>
Gerrit-Reviewer: Adar Dembo <[email protected]>
Gerrit-Reviewer: Dinesh Bhat <[email protected]>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: Lars Volker <[email protected]>
Gerrit-Reviewer: Mike Percy <[email protected]>
Gerrit-Reviewer: Tidy Bot
Gerrit-Reviewer: Todd Lipcon <[email protected]>
Gerrit-HasComments: Yes

Reply via email to