[Lldb-commits] [PATCH] D31086: Remove FileSystem::MakeDirectory

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 17 10:28:32 PDT 2017


zturner created this revision.

Use the LLVM function instead.

There are two subtle behavioral changes here which I want to make clear so someone can determine whether this matters on their platform.

1. Previously all LLDB callers were passing `eFilePermissionsDirectoryDefault` which is equal to `eFilePermissionsUserRWX` (0o700).  The LLVM default is equivalent to `eFilePermissionsUserRWX | eFilePermissionsGroupRWX` (0o770).  If this is a problem it's easy to update all callsites to explicitly pass 0o700, but I don't think it is.

2. The implementation of `MakeDirectory` would first try to create the directory, then if it failed due to `ENOENT` would try to create the parent directory.  But it only went up one level.  So if `/foo` existed but not `/foo/bar`, and you tried to create `/foo/bar/baz`, it would create `/foo/bar` first and then `/foo/bar/baz`.  On the other hand, if not even `/foo` existed, the function would fail.

This seems like very strange behavior to me, but I don't know if anyone depends on it.  I imagine if the tests pass everywhere, then nobody does.  They pass on Windows.  If someone could confirm that they pass on other platforms after this patch it would be helpful.


https://reviews.llvm.org/D31086

Files:
  lldb/include/lldb/Host/FileSystem.h
  lldb/source/Host/common/Editline.cpp
  lldb/source/Host/common/HostInfoBase.cpp
  lldb/source/Host/posix/FileSystem.cpp
  lldb/source/Host/windows/FileSystem.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Target/Platform.cpp
  lldb/tools/lldb-server/lldb-platform.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31086.92162.patch
Type: text/x-patch
Size: 9156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170317/7ea000c9/attachment-0001.bin>


More information about the lldb-commits mailing list