Loading adb/file_sync_service.cpp +12 −6 Original line number Diff line number Diff line Loading @@ -69,17 +69,23 @@ static bool update_capabilities(const char* path, uint64_t capabilities) { } static bool secure_mkdirs(const std::string& path) { if (path[0] != '/') return false; std::vector<std::string> path_components = android::base::Split(path, "/"); std::string partial_path; for (const auto& path_component : path_components) { uid_t uid = -1; gid_t gid = -1; unsigned int mode = 0775; uint64_t capabilities = 0; if (path[0] != '/') return false; if (path_component.empty()) { continue; } std::vector<std::string> path_components = android::base::Split(path, "/"); std::string partial_path; for (const auto& path_component : path_components) { if (partial_path.back() != OS_PATH_SEPARATOR) partial_path += OS_PATH_SEPARATOR; if (partial_path.empty() || partial_path.back() != OS_PATH_SEPARATOR) { partial_path += OS_PATH_SEPARATOR; } partial_path += path_component; if (should_use_fs_config(partial_path)) { Loading adb/test_device.py +15 −0 Original line number Diff line number Diff line Loading @@ -868,6 +868,21 @@ class FileOperationsTest(DeviceTest): self.assertTrue('Permission denied' in output or 'Read-only file system' in output) @requires_non_root def test_push_directory_creation(self): """Regression test for directory creation. Bug: http://b/110953234 """ with tempfile.NamedTemporaryFile() as tmp_file: tmp_file.write('\0' * 1024 * 1024) tmp_file.flush() remote_path = self.DEVICE_TEMP_DIR + '/test_push_directory_creation' self.device.shell(['rm', '-rf', remote_path]) remote_path += '/filename' self.device.push(local=tmp_file.name, remote=remote_path) def _test_pull(self, remote_file, checksum): tmp_write = tempfile.NamedTemporaryFile(mode='wb', delete=False) tmp_write.close() Loading Loading
adb/file_sync_service.cpp +12 −6 Original line number Diff line number Diff line Loading @@ -69,17 +69,23 @@ static bool update_capabilities(const char* path, uint64_t capabilities) { } static bool secure_mkdirs(const std::string& path) { if (path[0] != '/') return false; std::vector<std::string> path_components = android::base::Split(path, "/"); std::string partial_path; for (const auto& path_component : path_components) { uid_t uid = -1; gid_t gid = -1; unsigned int mode = 0775; uint64_t capabilities = 0; if (path[0] != '/') return false; if (path_component.empty()) { continue; } std::vector<std::string> path_components = android::base::Split(path, "/"); std::string partial_path; for (const auto& path_component : path_components) { if (partial_path.back() != OS_PATH_SEPARATOR) partial_path += OS_PATH_SEPARATOR; if (partial_path.empty() || partial_path.back() != OS_PATH_SEPARATOR) { partial_path += OS_PATH_SEPARATOR; } partial_path += path_component; if (should_use_fs_config(partial_path)) { Loading
adb/test_device.py +15 −0 Original line number Diff line number Diff line Loading @@ -868,6 +868,21 @@ class FileOperationsTest(DeviceTest): self.assertTrue('Permission denied' in output or 'Read-only file system' in output) @requires_non_root def test_push_directory_creation(self): """Regression test for directory creation. Bug: http://b/110953234 """ with tempfile.NamedTemporaryFile() as tmp_file: tmp_file.write('\0' * 1024 * 1024) tmp_file.flush() remote_path = self.DEVICE_TEMP_DIR + '/test_push_directory_creation' self.device.shell(['rm', '-rf', remote_path]) remote_path += '/filename' self.device.push(local=tmp_file.name, remote=remote_path) def _test_pull(self, remote_file, checksum): tmp_write = tempfile.NamedTemporaryFile(mode='wb', delete=False) tmp_write.close() Loading