From d08d3e91ac91746e7ba88c0ae5569d1e5303b9d4 Mon Sep 17 00:00:00 2001 From: LD Date: Wed, 22 Mar 2017 16:18:24 -0700 Subject: [PATCH 01/12] Sender and e2e test --- ByteSource.h | 2 ++ Protocol.cpp | 6 ++++-- Protocol.h | 10 ++++++---- SenderThread.cpp | 1 + WdtTransferRequest.h | 6 ++++++ test/wdt_e2e_simple_test.sh | 8 +++++++- util/DirectorySourceQueue.cpp | 10 +++++++++- 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ByteSource.h b/ByteSource.h index 34114906..8b088c87 100644 --- a/ByteSource.h +++ b/ByteSource.h @@ -44,6 +44,8 @@ struct SourceMetaData { FileAllocationStatus allocationStatus{NOT_EXISTS}; /// if there is a size mismatch, this is the previous sequence id int64_t prevSeqId{0}; + /// file permission. + int64_t permission{512}; /// If true, files are read using O_DIRECT or F_NOCACHE bool directReads{false}; /// File descriptor. If this is not -1, then wdt uses this to read diff --git a/Protocol.cpp b/Protocol.cpp index 39bc1a7d..966edd10 100644 --- a/Protocol.cpp +++ b/Protocol.cpp @@ -148,7 +148,8 @@ bool Protocol::encodeHeader(int senderProtocolVersion, char *dest, int64_t &off, encodeVarI64C(dest, umax, off, blockDetails.seqId) && encodeVarI64C(dest, umax, off, blockDetails.dataSize) && encodeVarI64C(dest, umax, off, blockDetails.offset) && - encodeVarI64C(dest, umax, off, blockDetails.fileSize); + encodeVarI64C(dest, umax, off, blockDetails.fileSize) && + encodeVarI64C(dest, umax, off, blockDetails.permission); if (ok && senderProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { uint8_t flags = blockDetails.allocationStatus; if (off >= max) { @@ -178,7 +179,8 @@ bool Protocol::decodeHeader(int receiverProtocolVersion, char *src, decodeInt64C(br, blockDetails.seqId) && decodeInt64C(br, blockDetails.dataSize) && decodeInt64C(br, blockDetails.offset) && - decodeInt64C(br, blockDetails.fileSize); + decodeInt64C(br, blockDetails.fileSize) && + decodeInt64C(br, blockDetails.permission); if (ok && receiverProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { if (br.empty()) { WLOG(ERROR) << "Invalid (too short) input len " << max << " at offset " diff --git a/Protocol.h b/Protocol.h index f138576d..992f5012 100644 --- a/Protocol.h +++ b/Protocol.h @@ -218,6 +218,8 @@ struct BlockDetails { FileAllocationStatus allocationStatus{NOT_EXISTS}; /// seq-id of previous transfer, only valid if there is a size mismatch int64_t prevSeqId{0}; + /// file permission in decimal. + int64_t permission{512}; }; /// structure representing settings cmd @@ -293,10 +295,10 @@ class Protocol { /// Max size of sender or receiver id static constexpr int64_t kMaxTransferIdLength = 50; - /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 4 - /// variants(seq-id, data-size, offset, file-size), 1 byte for flag, 10 bytes - /// prev seq-id - static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 4 * 10 + 1 + 10; + /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 5 + /// variants(seq-id, data-size, offset, file-size, permission), 1 byte for + /// flag, 10 bytes prev seq-id + static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 5 * 10 + 1 + 10; /// min number of bytes that must be send to unblock receiver static constexpr int64_t kMinBufLength = 256; /// max size of done command encoding(1 byte for cmd, 1 for status, 10 for diff --git a/SenderThread.cpp b/SenderThread.cpp index 9a674afd..0df7e6c4 100644 --- a/SenderThread.cpp +++ b/SenderThread.cpp @@ -266,6 +266,7 @@ TransferStats SenderThread::sendOneByteSource( blockDetails.dataSize = expectedSize; blockDetails.allocationStatus = metadata.allocationStatus; blockDetails.prevSeqId = metadata.prevSeqId; + blockDetails.permission = metadata.permission; Protocol::encodeHeader(wdtParent_->getProtocolVersion(), headerBuf, off, Protocol::kMaxHeader, blockDetails); int16_t littleEndianOff = folly::Endian::little((int16_t)off); diff --git a/WdtTransferRequest.h b/WdtTransferRequest.h index 09d39929..ca47b46e 100644 --- a/WdtTransferRequest.h +++ b/WdtTransferRequest.h @@ -35,6 +35,12 @@ struct WdtFileInfo { /// Whether read should be done using o_direct. If fd is set, this flag will /// be set automatically to match the fd open mode bool directReads{false}; + /// File permission in decimal. When smaller than oct777 (dec512), the + /// permission will be passed during transfer. + int64_t permission{512}; + /// Constructor for file info with name, size, odirect request and permission + WdtFileInfo(const std::string& name, + int64_t size, bool directReads, int64_t perm); /// Constructor for file info with name, size and odirect request WdtFileInfo(const std::string& name, int64_t size, bool directReads); /** diff --git a/test/wdt_e2e_simple_test.sh b/test/wdt_e2e_simple_test.sh index f0c754dc..ce1a4a5c 100755 --- a/test/wdt_e2e_simple_test.sh +++ b/test/wdt_e2e_simple_test.sh @@ -137,7 +137,13 @@ if [ $DO_VERIFY -eq 1 ] ; then echo "Should be no diff" (cd $DIR; diff -u src.md5s dst.md5s) STATUS=$? + if [ $STATUS -eq 0 ] ; then + (cd $DIR/src ; ( find . -type f -printf %f%m\\n | sort ) > ../src.perm ) + (cd $DIR/dest ; ( find . -type f -printf %f%m\\n | sort ) > ../dest.perm ) + (cd $DIR; diff -u src.perm dst.perm) + STATUS=$? + fi if [ $WDT_TEST_SYMLINKS -eq 1 ]; then echo "Verifying for run with follow_symlinks" @@ -150,9 +156,9 @@ if [ $DO_VERIFY -eq 1 ] ; then > ../src_symlinks.md5s ) (cd $DIR/dst_symlinks ; ( find . -type f -print0 | xargs -0 $MD5SUM \ | sort ) > ../dst_symlinks.md5s ) - echo "Should be no diff" (cd $DIR; diff -u src_symlinks.md5s dst_symlinks.md5s) + SYMLINK_STATUS=$? if [ $STATUS -eq 0 ] ; then STATUS=$SYMLINK_STATUS diff --git a/util/DirectorySourceQueue.cpp b/util/DirectorySourceQueue.cpp index 420d9588..718b17e6 100644 --- a/util/DirectorySourceQueue.cpp +++ b/util/DirectorySourceQueue.cpp @@ -33,6 +33,12 @@ WdtFileInfo::WdtFileInfo(const string &name, int64_t size, bool doDirectReads) : fileName(name), fileSize(size), directReads(doDirectReads) { } +WdtFileInfo::WdtFileInfo(const string &name, + int64_t size, bool doDirectReads, int64_t perm) + : WdtFileInfo(name, size, doDirectReads){ + permission = perm; +} + WdtFileInfo::WdtFileInfo(int fd, int64_t size, const string &name) : WdtFileInfo(name, size, false) { this->fd = fd; @@ -360,7 +366,9 @@ bool DirectorySourceQueue::explore() { !std::regex_match(newRelativePath, includeRegex)) { continue; } - WdtFileInfo fileInfo(newRelativePath, fileStat.st_size, directReads_); + int perm = fileStat.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + WdtFileInfo fileInfo(newRelativePath, + fileStat.st_size, directReads_, perm); createIntoQueue(newFullPath, fileInfo); continue; } From 8e671b7bf8afbffb8b4a29c14dc590b0720f1f52 Mon Sep 17 00:00:00 2001 From: LD Date: Wed, 22 Mar 2017 17:00:29 -0700 Subject: [PATCH 02/12] Protocol test for permission --- test/ProtocolTest.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/ProtocolTest.cpp b/test/ProtocolTest.cpp index e6c4f4b1..eb7fbec5 100644 --- a/test/ProtocolTest.cpp +++ b/test/ProtocolTest.cpp @@ -25,6 +25,7 @@ void testHeader() { bd.dataSize = 3; bd.offset = 4; bd.fileSize = 10; + bd.permission = 2; bd.allocationStatus = EXISTS_CORRECT_SIZE; char buf[128]; @@ -32,8 +33,9 @@ void testHeader() { Protocol::encodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, off, sizeof(buf), bd); EXPECT_EQ(off, - bd.fileName.size() + 1 + 1 + 1 + 1 + 1 + - 1); // 1 byte variant for seqId, len, size, offset and filesize + bd.fileName.size() + 1 + 1 + 1 + 1 + 1 + 1 + + 1); // 1 byte variant for seqId, len, size, offset, filesize + // and permission BlockDetails nbd; int64_t noff = 0; bool success = @@ -47,6 +49,7 @@ void testHeader() { EXPECT_EQ(nbd.offset, bd.offset); EXPECT_EQ(nbd.dataSize, bd.dataSize); EXPECT_EQ(nbd.allocationStatus, bd.allocationStatus); + EXPECT_EQ(nbd.permission, bd.permission); noff = 0; // exact size: success = Protocol::decodeHeader( @@ -66,6 +69,7 @@ void testHeader() { bd.seqId = 5; bd.offset = 3; bd.fileSize = 128; + bd.permission = 511; // 777 bd.allocationStatus = EXISTS_TOO_SMALL; bd.prevSeqId = 10; @@ -73,8 +77,8 @@ void testHeader() { Protocol::encodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, off, sizeof(buf), bd); EXPECT_EQ(off, - bd.fileName.size() + 1 + 1 + 6 + 1 + 2 + 1 + - 1); // 1 byte variant for id len and size + bd.fileName.size() + 1 + 1 + 6 + 1 + 2 + 1 + 1 + + 2); // 1 byte variant for id len and size noff = 0; success = Protocol::decodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, @@ -86,6 +90,7 @@ void testHeader() { EXPECT_EQ(nbd.fileSize, bd.fileSize); EXPECT_EQ(nbd.offset, bd.offset); EXPECT_EQ(nbd.dataSize, bd.dataSize); + EXPECT_EQ(nbd.permission, bd.permission); EXPECT_EQ(nbd.allocationStatus, bd.allocationStatus); EXPECT_EQ(nbd.prevSeqId, bd.prevSeqId); WLOG(INFO) << "got size of " << nbd.dataSize; From b85b5592aeca63764ee6fe53228fd55610094a61 Mon Sep 17 00:00:00 2001 From: LD Date: Sat, 25 Mar 2017 22:57:17 -0700 Subject: [PATCH 03/12] receiver side --- test/wdt_e2e_simple_test.sh | 2 +- util/DirectorySourceQueue.cpp | 1 + util/FileCreator.cpp | 18 ++++++++++++++---- util/FileCreator.h | 3 ++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/wdt_e2e_simple_test.sh b/test/wdt_e2e_simple_test.sh index ce1a4a5c..08ffde25 100755 --- a/test/wdt_e2e_simple_test.sh +++ b/test/wdt_e2e_simple_test.sh @@ -139,7 +139,7 @@ if [ $DO_VERIFY -eq 1 ] ; then STATUS=$? if [ $STATUS -eq 0 ] ; then (cd $DIR/src ; ( find . -type f -printf %f%m\\n | sort ) > ../src.perm ) - (cd $DIR/dest ; ( find . -type f -printf %f%m\\n | sort ) > ../dest.perm ) + (cd $DIR/dst ; ( find . -type f -printf %f%m\\n | sort ) > ../dst.perm ) (cd $DIR; diff -u src.perm dst.perm) STATUS=$? diff --git a/util/DirectorySourceQueue.cpp b/util/DirectorySourceQueue.cpp index 718b17e6..187ed079 100644 --- a/util/DirectorySourceQueue.cpp +++ b/util/DirectorySourceQueue.cpp @@ -448,6 +448,7 @@ void DirectorySourceQueue::createIntoQueue(const string &fullPath, metadata->fd = fileInfo.fd; metadata->directReads = fileInfo.directReads; metadata->size = fileInfo.fileSize; + metadata->permission = fileInfo.permission; if ((openFilesDuringDiscovery_ != 0) && (metadata->fd < 0)) { metadata->fd = FileUtil::openForRead(*threadCtx_, fullPath, metadata->directReads); diff --git a/util/FileCreator.cpp b/util/FileCreator.cpp index 11a43c90..48e6b7d0 100644 --- a/util/FileCreator.cpp +++ b/util/FileCreator.cpp @@ -58,7 +58,8 @@ int FileCreator::openAndSetSize(ThreadCtx &threadCtx, const bool doCreate = (blockDetails->allocationStatus == NOT_EXISTS); const bool isTooLarge = (blockDetails->allocationStatus == EXISTS_TOO_LARGE); if (doCreate) { - fd = createFile(threadCtx, blockDetails->fileName); + fd = createFile(threadCtx, + blockDetails->fileName, blockDetails->permission); } else { fd = openExistingFile(threadCtx, blockDetails->fileName); } @@ -197,7 +198,16 @@ int FileCreator::openExistingFile(ThreadCtx &threadCtx, return res; } -int FileCreator::createFile(ThreadCtx &threadCtx, const string &relPathStr) { +int openWithPerm(const char *path, int oFlags, int perm) { + if (perm >= 512) { + // no permission specified + return open(path, oFlags, 0644); + } + return open(path, oFlags, perm); +} + +int FileCreator::createFile(ThreadCtx &threadCtx, + const string &relPathStr, int64_t permission) { CHECK(!relPathStr.empty()); CHECK(relPathStr[0] != '/'); CHECK(relPathStr.back() != '/'); @@ -255,7 +265,7 @@ int FileCreator::createFile(ThreadCtx &threadCtx, const string &relPathStr) { int res; { PerfStatCollector statCollector(threadCtx, PerfStatReport::FILE_OPEN); - res = open(path.c_str(), openFlags, 0644); + res = openWithPerm(path.c_str(), openFlags, permission); } if (res < 0) { if (dir.empty()) { @@ -276,7 +286,7 @@ int FileCreator::createFile(ThreadCtx &threadCtx, const string &relPathStr) { } { PerfStatCollector statCollector(threadCtx, PerfStatReport::FILE_OPEN); - res = open(path.c_str(), openFlags, 0644); + res = openWithPerm(path.c_str(), openFlags, permission); } if (res < 0) { WPLOG(ERROR) << "failed creating file " << path; diff --git a/util/FileCreator.h b/util/FileCreator.h index 1ebd30c6..ec48cb88 100644 --- a/util/FileCreator.h +++ b/util/FileCreator.h @@ -108,7 +108,8 @@ class FileCreator { * * @return file descriptor or -1 on error */ - int createFile(ThreadCtx &threadCtx, const std::string &relPath); + int createFile(ThreadCtx &threadCtx, + const std::string &relPath, int64_t permission); /** * Open existing file */ From 93e61d3d3bd56ff5ad27808f4f535777d29e0bbc Mon Sep 17 00:00:00 2001 From: LD Date: Sun, 26 Mar 2017 19:42:03 -0700 Subject: [PATCH 04/12] add protocol version --- CMakeLists.txt | 2 +- Protocol.cpp | 13 +++++++++---- Protocol.h | 2 ++ WdtConfig.h | 6 +++--- test/ProtocolTest.cpp | 19 +++++++++---------- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b332497..46324238 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.2) # There is no C per se in WDT but if you use CXX only here many checks fail # Version is Major.Minor.YYMMDDX for up to 10 releases per day (X from 0 to 9) # Minor currently is also the protocol version - has to match with Protocol.cpp -project("WDT" LANGUAGES C CXX VERSION 1.27.1702060) +project("WDT" LANGUAGES C CXX VERSION 1.30.1703270) # On MacOS this requires the latest (master) CMake (and/or CMake 3.1.1/3.2) # WDT itself works fine with C++11 (gcc 4.8 for instance) but more recent folly diff --git a/Protocol.cpp b/Protocol.cpp index 966edd10..970a91ea 100644 --- a/Protocol.cpp +++ b/Protocol.cpp @@ -34,6 +34,7 @@ const int Protocol::ENCRYPTION_V1_VERSION = 23; const int Protocol::INCREMENTAL_TAG_VERIFICATION_VERSION = 25; const int Protocol::DELETE_CMD_VERSION = 26; const int Protocol::VARINT_CHANGE = 27; +const int Protocol::KEEP_PERMISSION = 30; /* All methods of Protocol class are static (functions) */ @@ -148,8 +149,10 @@ bool Protocol::encodeHeader(int senderProtocolVersion, char *dest, int64_t &off, encodeVarI64C(dest, umax, off, blockDetails.seqId) && encodeVarI64C(dest, umax, off, blockDetails.dataSize) && encodeVarI64C(dest, umax, off, blockDetails.offset) && - encodeVarI64C(dest, umax, off, blockDetails.fileSize) && - encodeVarI64C(dest, umax, off, blockDetails.permission); + encodeVarI64C(dest, umax, off, blockDetails.fileSize); + if (ok && senderProtocolVersion >= KEEP_PERMISSION) { + ok = encodeVarI64C(dest, umax, off, blockDetails.permission); + } if (ok && senderProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { uint8_t flags = blockDetails.allocationStatus; if (off >= max) { @@ -179,8 +182,10 @@ bool Protocol::decodeHeader(int receiverProtocolVersion, char *src, decodeInt64C(br, blockDetails.seqId) && decodeInt64C(br, blockDetails.dataSize) && decodeInt64C(br, blockDetails.offset) && - decodeInt64C(br, blockDetails.fileSize) && - decodeInt64C(br, blockDetails.permission); + decodeInt64C(br, blockDetails.fileSize); + if (ok && receiverProtocolVersion >= KEEP_PERMISSION) { + ok = decodeInt64C(br, blockDetails.permission); + } if (ok && receiverProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { if (br.empty()) { WLOG(ERROR) << "Invalid (too short) input len " << max << " at offset " diff --git a/Protocol.h b/Protocol.h index 992f5012..3dfc8db1 100644 --- a/Protocol.h +++ b/Protocol.h @@ -268,6 +268,8 @@ class Protocol { static const int DELETE_CMD_VERSION; /// version from which we switched varint to better one static const int VARINT_CHANGE; + /// version from which file permission is kept during transfer + static const int KEEP_PERMISSION; /// Both version, magic number and command byte enum CMD_MAGIC { diff --git a/WdtConfig.h b/WdtConfig.h index fedb65b3..bb7b64d5 100644 --- a/WdtConfig.h +++ b/WdtConfig.h @@ -10,10 +10,10 @@ #include #define WDT_VERSION_MAJOR 1 -#define WDT_VERSION_MINOR 27 -#define WDT_VERSION_BUILD 1702060 +#define WDT_VERSION_MINOR 30 +#define WDT_VERSION_BUILD 1703270 // Add -fbcode to version str -#define WDT_VERSION_STR "1.27.1702060-fbcode" +#define WDT_VERSION_STR "1.30.1703270-fbcode" // Tie minor and proto version #define WDT_PROTOCOL_VERSION WDT_VERSION_MINOR diff --git a/test/ProtocolTest.cpp b/test/ProtocolTest.cpp index eb7fbec5..6e7b5513 100644 --- a/test/ProtocolTest.cpp +++ b/test/ProtocolTest.cpp @@ -30,7 +30,7 @@ void testHeader() { char buf[128]; int64_t off = 0; - Protocol::encodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, + Protocol::encodeHeader(Protocol::KEEP_PERMISSION, buf, off, sizeof(buf), bd); EXPECT_EQ(off, bd.fileName.size() + 1 + 1 + 1 + 1 + 1 + 1 + @@ -39,8 +39,8 @@ void testHeader() { BlockDetails nbd; int64_t noff = 0; bool success = - Protocol::decodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, - noff, sizeof(buf), nbd); + Protocol::decodeHeader(Protocol::KEEP_PERMISSION, buf, noff, sizeof(buf), + nbd); EXPECT_TRUE(success); EXPECT_EQ(noff, off); EXPECT_EQ(nbd.fileName, bd.fileName); @@ -53,14 +53,14 @@ void testHeader() { noff = 0; // exact size: success = Protocol::decodeHeader( - Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, noff, off, nbd); + Protocol::KEEP_PERMISSION, buf, noff, off, nbd); EXPECT_TRUE(success); WLOG(INFO) << "error tests, expect errors"; // too short noff = 0; success = Protocol::decodeHeader( - Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, noff, off - 1, nbd); + Protocol::KEEP_PERMISSION, buf, noff, off - 1, nbd); EXPECT_FALSE(success); // Long size: @@ -74,15 +74,14 @@ void testHeader() { bd.prevSeqId = 10; off = 0; - Protocol::encodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, - off, sizeof(buf), bd); + Protocol::encodeHeader(Protocol::KEEP_PERMISSION, buf, off, sizeof(buf), bd); EXPECT_EQ(off, bd.fileName.size() + 1 + 1 + 6 + 1 + 2 + 1 + 1 + 2); // 1 byte variant for id len and size noff = 0; success = - Protocol::decodeHeader(Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, - noff, sizeof(buf), nbd); + Protocol::decodeHeader(Protocol::KEEP_PERMISSION, buf, noff, sizeof(buf), + nbd); EXPECT_TRUE(success); EXPECT_EQ(noff, off); EXPECT_EQ(nbd.fileName, bd.fileName); @@ -97,7 +96,7 @@ void testHeader() { // too short for size encoding: noff = 0; success = Protocol::decodeHeader( - Protocol::HEADER_FLAG_AND_PREV_SEQ_ID_VERSION, buf, noff, off - 2, nbd); + Protocol::KEEP_PERMISSION, buf, noff, off - 2, nbd); EXPECT_FALSE(success); } From b6def075d185202a1e7461bb6147a2a5390b9f94 Mon Sep 17 00:00:00 2001 From: LD Date: Wed, 29 Mar 2017 10:56:32 -0700 Subject: [PATCH 05/12] change default permission to 0644; read permission from stat instead of request if !dir; change protocol name TODO: test for !dir request --- ByteSource.h | 2 +- CMakeLists.txt | 2 +- Protocol.cpp | 12 +++++++----- Protocol.h | 14 +++++++------- WdtConfig.h | 6 +++--- WdtTransferRequest.h | 5 ++--- test/ProtocolTest.cpp | 21 +++++++++++---------- util/DirectorySourceQueue.cpp | 11 ++++++----- util/FileCreator.cpp | 12 ++---------- 9 files changed, 40 insertions(+), 45 deletions(-) diff --git a/ByteSource.h b/ByteSource.h index 8b088c87..50b5b26a 100644 --- a/ByteSource.h +++ b/ByteSource.h @@ -45,7 +45,7 @@ struct SourceMetaData { /// if there is a size mismatch, this is the previous sequence id int64_t prevSeqId{0}; /// file permission. - int64_t permission{512}; + int32_t permission{0}; /// If true, files are read using O_DIRECT or F_NOCACHE bool directReads{false}; /// File descriptor. If this is not -1, then wdt uses this to read diff --git a/CMakeLists.txt b/CMakeLists.txt index 46324238..9157e426 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.2) # There is no C per se in WDT but if you use CXX only here many checks fail # Version is Major.Minor.YYMMDDX for up to 10 releases per day (X from 0 to 9) # Minor currently is also the protocol version - has to match with Protocol.cpp -project("WDT" LANGUAGES C CXX VERSION 1.30.1703270) +project("WDT" LANGUAGES C CXX VERSION 1.31.1703290) # On MacOS this requires the latest (master) CMake (and/or CMake 3.1.1/3.2) # WDT itself works fine with C++11 (gcc 4.8 for instance) but more recent folly diff --git a/Protocol.cpp b/Protocol.cpp index 970a91ea..9381b04a 100644 --- a/Protocol.cpp +++ b/Protocol.cpp @@ -34,7 +34,7 @@ const int Protocol::ENCRYPTION_V1_VERSION = 23; const int Protocol::INCREMENTAL_TAG_VERIFICATION_VERSION = 25; const int Protocol::DELETE_CMD_VERSION = 26; const int Protocol::VARINT_CHANGE = 27; -const int Protocol::KEEP_PERMISSION = 30; +const int Protocol::PRESERVE_PERMISSION = 31; /* All methods of Protocol class are static (functions) */ @@ -149,8 +149,8 @@ bool Protocol::encodeHeader(int senderProtocolVersion, char *dest, int64_t &off, encodeVarI64C(dest, umax, off, blockDetails.seqId) && encodeVarI64C(dest, umax, off, blockDetails.dataSize) && encodeVarI64C(dest, umax, off, blockDetails.offset) && - encodeVarI64C(dest, umax, off, blockDetails.fileSize); - if (ok && senderProtocolVersion >= KEEP_PERMISSION) { + encodeVarI64C(dest, umax, off, (int64_t) blockDetails.fileSize); + if (ok && senderProtocolVersion >= PRESERVE_PERMISSION) { ok = encodeVarI64C(dest, umax, off, blockDetails.permission); } if (ok && senderProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { @@ -183,8 +183,10 @@ bool Protocol::decodeHeader(int receiverProtocolVersion, char *src, decodeInt64C(br, blockDetails.dataSize) && decodeInt64C(br, blockDetails.offset) && decodeInt64C(br, blockDetails.fileSize); - if (ok && receiverProtocolVersion >= KEEP_PERMISSION) { - ok = decodeInt64C(br, blockDetails.permission); + if (ok && receiverProtocolVersion >= PRESERVE_PERMISSION) { + int64_t perm; + ok = decodeInt64C(br, perm); + blockDetails.permission = (int32_t) perm; } if (ok && receiverProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { if (br.empty()) { diff --git a/Protocol.h b/Protocol.h index 3dfc8db1..1bea1e40 100644 --- a/Protocol.h +++ b/Protocol.h @@ -218,8 +218,8 @@ struct BlockDetails { FileAllocationStatus allocationStatus{NOT_EXISTS}; /// seq-id of previous transfer, only valid if there is a size mismatch int64_t prevSeqId{0}; - /// file permission in decimal. - int64_t permission{512}; + /// file permission + int32_t permission{0644}; }; /// structure representing settings cmd @@ -269,7 +269,7 @@ class Protocol { /// version from which we switched varint to better one static const int VARINT_CHANGE; /// version from which file permission is kept during transfer - static const int KEEP_PERMISSION; + static const int PRESERVE_PERMISSION; /// Both version, magic number and command byte enum CMD_MAGIC { @@ -297,10 +297,10 @@ class Protocol { /// Max size of sender or receiver id static constexpr int64_t kMaxTransferIdLength = 50; - /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 5 - /// variants(seq-id, data-size, offset, file-size, permission), 1 byte for - /// flag, 10 bytes prev seq-id - static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 5 * 10 + 1 + 10; + /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 4 + /// variants(seq-id, data-size, offset, file-size), 2 byte for permission, 1 + /// byte for flag, 10 bytes prev seq-id + static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 4 * 10 + 2 + 1 + 10; /// min number of bytes that must be send to unblock receiver static constexpr int64_t kMinBufLength = 256; /// max size of done command encoding(1 byte for cmd, 1 for status, 10 for diff --git a/WdtConfig.h b/WdtConfig.h index bb7b64d5..6f916b45 100644 --- a/WdtConfig.h +++ b/WdtConfig.h @@ -10,10 +10,10 @@ #include #define WDT_VERSION_MAJOR 1 -#define WDT_VERSION_MINOR 30 -#define WDT_VERSION_BUILD 1703270 +#define WDT_VERSION_MINOR 31 +#define WDT_VERSION_BUILD 1703290 // Add -fbcode to version str -#define WDT_VERSION_STR "1.30.1703270-fbcode" +#define WDT_VERSION_STR "1.31.1703270-fbcode" // Tie minor and proto version #define WDT_PROTOCOL_VERSION WDT_VERSION_MINOR diff --git a/WdtTransferRequest.h b/WdtTransferRequest.h index ca47b46e..c199f4a4 100644 --- a/WdtTransferRequest.h +++ b/WdtTransferRequest.h @@ -35,9 +35,8 @@ struct WdtFileInfo { /// Whether read should be done using o_direct. If fd is set, this flag will /// be set automatically to match the fd open mode bool directReads{false}; - /// File permission in decimal. When smaller than oct777 (dec512), the - /// permission will be passed during transfer. - int64_t permission{512}; + /// File permission. + int32_t permission; /// Constructor for file info with name, size, odirect request and permission WdtFileInfo(const std::string& name, int64_t size, bool directReads, int64_t perm); diff --git a/test/ProtocolTest.cpp b/test/ProtocolTest.cpp index 6e7b5513..dc0e358b 100644 --- a/test/ProtocolTest.cpp +++ b/test/ProtocolTest.cpp @@ -30,8 +30,8 @@ void testHeader() { char buf[128]; int64_t off = 0; - Protocol::encodeHeader(Protocol::KEEP_PERMISSION, buf, - off, sizeof(buf), bd); + Protocol::encodeHeader(Protocol::PRESERVE_PERMISSION, buf, off, sizeof(buf), + bd); EXPECT_EQ(off, bd.fileName.size() + 1 + 1 + 1 + 1 + 1 + 1 + 1); // 1 byte variant for seqId, len, size, offset, filesize @@ -39,8 +39,8 @@ void testHeader() { BlockDetails nbd; int64_t noff = 0; bool success = - Protocol::decodeHeader(Protocol::KEEP_PERMISSION, buf, noff, sizeof(buf), - nbd); + Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, + sizeof(buf), nbd); EXPECT_TRUE(success); EXPECT_EQ(noff, off); EXPECT_EQ(nbd.fileName, bd.fileName); @@ -53,14 +53,14 @@ void testHeader() { noff = 0; // exact size: success = Protocol::decodeHeader( - Protocol::KEEP_PERMISSION, buf, noff, off, nbd); + Protocol::PRESERVE_PERMISSION, buf, noff, off, nbd); EXPECT_TRUE(success); WLOG(INFO) << "error tests, expect errors"; // too short noff = 0; success = Protocol::decodeHeader( - Protocol::KEEP_PERMISSION, buf, noff, off - 1, nbd); + Protocol::PRESERVE_PERMISSION, buf, noff, off - 1, nbd); EXPECT_FALSE(success); // Long size: @@ -74,14 +74,15 @@ void testHeader() { bd.prevSeqId = 10; off = 0; - Protocol::encodeHeader(Protocol::KEEP_PERMISSION, buf, off, sizeof(buf), bd); + Protocol::encodeHeader(Protocol::PRESERVE_PERMISSION, buf, off, sizeof(buf), + bd); EXPECT_EQ(off, bd.fileName.size() + 1 + 1 + 6 + 1 + 2 + 1 + 1 + 2); // 1 byte variant for id len and size noff = 0; success = - Protocol::decodeHeader(Protocol::KEEP_PERMISSION, buf, noff, sizeof(buf), - nbd); + Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, + sizeof(buf), nbd); EXPECT_TRUE(success); EXPECT_EQ(noff, off); EXPECT_EQ(nbd.fileName, bd.fileName); @@ -96,7 +97,7 @@ void testHeader() { // too short for size encoding: noff = 0; success = Protocol::decodeHeader( - Protocol::KEEP_PERMISSION, buf, noff, off - 2, nbd); + Protocol::PRESERVE_PERMISSION, buf, noff, off - 2, nbd); EXPECT_FALSE(success); } diff --git a/util/DirectorySourceQueue.cpp b/util/DirectorySourceQueue.cpp index 187ed079..1f89d1ab 100644 --- a/util/DirectorySourceQueue.cpp +++ b/util/DirectorySourceQueue.cpp @@ -566,14 +566,15 @@ bool DirectorySourceQueue::enqueueFiles() { return false; } string fullPath = rootDir_ + info.fileName; + struct stat fileStat; + if (stat(fullPath.c_str(), &fileStat) != 0) { + WPLOG(ERROR) << "stat failed on path " << fullPath; + return false; + } if (info.fileSize < 0) { - struct stat fileStat; - if (stat(fullPath.c_str(), &fileStat) != 0) { - WPLOG(ERROR) << "stat failed on path " << fullPath; - return false; - } info.fileSize = fileStat.st_size; } + info.permission = fileStat.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); createIntoQueue(fullPath, info); } return true; diff --git a/util/FileCreator.cpp b/util/FileCreator.cpp index 48e6b7d0..8537f371 100644 --- a/util/FileCreator.cpp +++ b/util/FileCreator.cpp @@ -198,14 +198,6 @@ int FileCreator::openExistingFile(ThreadCtx &threadCtx, return res; } -int openWithPerm(const char *path, int oFlags, int perm) { - if (perm >= 512) { - // no permission specified - return open(path, oFlags, 0644); - } - return open(path, oFlags, perm); -} - int FileCreator::createFile(ThreadCtx &threadCtx, const string &relPathStr, int64_t permission) { CHECK(!relPathStr.empty()); @@ -265,7 +257,7 @@ int FileCreator::createFile(ThreadCtx &threadCtx, int res; { PerfStatCollector statCollector(threadCtx, PerfStatReport::FILE_OPEN); - res = openWithPerm(path.c_str(), openFlags, permission); + res = open(path.c_str(), openFlags, permission); } if (res < 0) { if (dir.empty()) { @@ -286,7 +278,7 @@ int FileCreator::createFile(ThreadCtx &threadCtx, } { PerfStatCollector statCollector(threadCtx, PerfStatReport::FILE_OPEN); - res = openWithPerm(path.c_str(), openFlags, permission); + res = open(path.c_str(), openFlags, permission); } if (res < 0) { WPLOG(ERROR) << "failed creating file " << path; From 37ddca58c9f787be3c4471d1f7666b52381fa4e6 Mon Sep 17 00:00:00 2001 From: LD Date: Fri, 31 Mar 2017 13:55:15 -0700 Subject: [PATCH 06/12] include set-user-ID bit | set-group-ID bit | sticky bit in permission --- CMakeLists.txt | 2 +- Protocol.cpp | 6 ++---- Protocol.h | 8 ++++---- WdtConfig.h | 4 ++-- WdtTransferRequest.h | 2 +- util/DirectorySourceQueue.cpp | 11 ++++++++--- util/FileCreator.cpp | 2 +- util/FileCreator.h | 14 +++++++------- 8 files changed, 26 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9157e426..79ff4d51 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.2) # There is no C per se in WDT but if you use CXX only here many checks fail # Version is Major.Minor.YYMMDDX for up to 10 releases per day (X from 0 to 9) # Minor currently is also the protocol version - has to match with Protocol.cpp -project("WDT" LANGUAGES C CXX VERSION 1.31.1703290) +project("WDT" LANGUAGES C CXX VERSION 1.31.1703310) # On MacOS this requires the latest (master) CMake (and/or CMake 3.1.1/3.2) # WDT itself works fine with C++11 (gcc 4.8 for instance) but more recent folly diff --git a/Protocol.cpp b/Protocol.cpp index dbb9ecb1..47574f14 100644 --- a/Protocol.cpp +++ b/Protocol.cpp @@ -149,7 +149,7 @@ bool Protocol::encodeHeader(int senderProtocolVersion, char *dest, int64_t &off, encodeVarI64C(dest, umax, off, blockDetails.seqId) && encodeVarI64C(dest, umax, off, blockDetails.dataSize) && encodeVarI64C(dest, umax, off, blockDetails.offset) && - encodeVarI64C(dest, umax, off, (int64_t) blockDetails.fileSize); + encodeVarI64C(dest, umax, off, blockDetails.fileSize); if (ok && senderProtocolVersion >= PRESERVE_PERMISSION) { ok = encodeVarI64C(dest, umax, off, blockDetails.permission); } @@ -184,9 +184,7 @@ bool Protocol::decodeHeader(int receiverProtocolVersion, char *src, decodeInt64C(br, blockDetails.offset) && decodeInt64C(br, blockDetails.fileSize); if (ok && receiverProtocolVersion >= PRESERVE_PERMISSION) { - int64_t perm; - ok = decodeInt64C(br, perm); - blockDetails.permission = (int32_t) perm; + ok = decodeInt32C(br, blockDetails.permission); } if (ok && receiverProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { if (br.empty()) { diff --git a/Protocol.h b/Protocol.h index 72e84624..3208377b 100644 --- a/Protocol.h +++ b/Protocol.h @@ -304,10 +304,10 @@ class Protocol { /// Max size of sender or receiver id static constexpr int64_t kMaxTransferIdLength = 50; - /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 4 - /// variants(seq-id, data-size, offset, file-size), 2 byte for permission, 1 - /// byte for flag, 10 bytes prev seq-id - static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 4 * 10 + 2 + 1 + 10; + /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 5 + /// variants(seq-id, data-size, offset, file-size, permission), 1 byte for + /// flag, 10 bytes prev seq-id + static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 5 * 10 + 2 + 1 + 10; /// min number of bytes that must be send to unblock receiver static constexpr int64_t kMinBufLength = 256; /// max size of done command encoding(1 byte for cmd, 1 for status, 10 for diff --git a/WdtConfig.h b/WdtConfig.h index 93a7f3eb..6cf78d5c 100644 --- a/WdtConfig.h +++ b/WdtConfig.h @@ -11,9 +11,9 @@ #define WDT_VERSION_MAJOR 1 #define WDT_VERSION_MINOR 31 -#define WDT_VERSION_BUILD 1703290 +#define WDT_VERSION_BUILD 1703310 // Add -fbcode to version str -#define WDT_VERSION_STR "1.31.1703290-fbcode" +#define WDT_VERSION_STR "1.31.1703310-fbcode" // Tie minor and proto version #define WDT_PROTOCOL_VERSION WDT_VERSION_MINOR diff --git a/WdtTransferRequest.h b/WdtTransferRequest.h index c31e74c8..13b7a690 100644 --- a/WdtTransferRequest.h +++ b/WdtTransferRequest.h @@ -39,7 +39,7 @@ struct WdtFileInfo { int32_t permission; /// Constructor for file info with name, size, odirect request and permission WdtFileInfo(const std::string& name, - int64_t size, bool directReads, int64_t perm); + int64_t size, bool directReads, int32_t perm); /// Constructor for file info with name, size and odirect request WdtFileInfo(const std::string& name, int64_t size, bool directReads); /** diff --git a/util/DirectorySourceQueue.cpp b/util/DirectorySourceQueue.cpp index 1f89d1ab..794578c9 100644 --- a/util/DirectorySourceQueue.cpp +++ b/util/DirectorySourceQueue.cpp @@ -34,7 +34,7 @@ WdtFileInfo::WdtFileInfo(const string &name, int64_t size, bool doDirectReads) } WdtFileInfo::WdtFileInfo(const string &name, - int64_t size, bool doDirectReads, int64_t perm) + int64_t size, bool doDirectReads, int32_t perm) : WdtFileInfo(name, size, doDirectReads){ permission = perm; } @@ -242,6 +242,11 @@ string DirectorySourceQueue::resolvePath(const string &path) { return result; } +int getPermission(int mode) { + // set-user-ID bit | set-group-ID bit | sticky bit | owner | group | others + return mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO); +} + bool DirectorySourceQueue::explore() { WLOG(INFO) << "Exploring root dir " << rootDir_ << " include_pattern : " << includePattern_ @@ -366,7 +371,7 @@ bool DirectorySourceQueue::explore() { !std::regex_match(newRelativePath, includeRegex)) { continue; } - int perm = fileStat.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + const int perm = getPermission(fileStat.st_mode); WdtFileInfo fileInfo(newRelativePath, fileStat.st_size, directReads_, perm); createIntoQueue(newFullPath, fileInfo); @@ -574,7 +579,7 @@ bool DirectorySourceQueue::enqueueFiles() { if (info.fileSize < 0) { info.fileSize = fileStat.st_size; } - info.permission = fileStat.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); + info.permission = getPermission(fileStat.st_mode); createIntoQueue(fullPath, info); } return true; diff --git a/util/FileCreator.cpp b/util/FileCreator.cpp index 8537f371..f1b9910d 100644 --- a/util/FileCreator.cpp +++ b/util/FileCreator.cpp @@ -199,7 +199,7 @@ int FileCreator::openExistingFile(ThreadCtx &threadCtx, } int FileCreator::createFile(ThreadCtx &threadCtx, - const string &relPathStr, int64_t permission) { + const string &relPathStr, int32_t permission) { CHECK(!relPathStr.empty()); CHECK(relPathStr[0] != '/'); CHECK(relPathStr.back() != '/'); diff --git a/util/FileCreator.h b/util/FileCreator.h index ec48cb88..5c0e8143 100644 --- a/util/FileCreator.h +++ b/util/FileCreator.h @@ -96,20 +96,20 @@ class FileCreator { int openAndSetSize(ThreadCtx &threadCtx, BlockDetails const *blockDetails); /** - * Create a file and open for writing, recursively create subdirs. - * Subdirs are only created once due to createdDirs_ cache, but - * if an open fails where we assumed the directory already exists - * based on cache, we try creating the dir and open again before - * failing. Will not overwrite existing files unless overwrite option - * is set. + * Create a file and open for writing with the given permission, recursively + * create subdirs. Subdirs are only created once due to createdDirs_ cache, + * but if an open fails where we assumed the directory already exists based on + * cache, we try creating the dir and open again before failing. Will not + * overwrite existing files unless overwrite option is set. * * @param threadCtx context of the calling thread * @param relPath path relative to root dir + * @param permission permission to use for the file * * @return file descriptor or -1 on error */ int createFile(ThreadCtx &threadCtx, - const std::string &relPath, int64_t permission); + const std::string &relPath, int32_t permission); /** * Open existing file */ From 6a9dae2479a5b613fe7210266873a0c00e87a2f7 Mon Sep 17 00:00:00 2001 From: LD Date: Mon, 3 Apr 2017 19:38:54 -0700 Subject: [PATCH 07/12] Read file tests and Protocol.h neglect correction --- Protocol.h | 2 +- test/FileReaderTest.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Protocol.h b/Protocol.h index 3208377b..1a06005a 100644 --- a/Protocol.h +++ b/Protocol.h @@ -307,7 +307,7 @@ class Protocol { /// 1 byte for cmd, 2 bytes for file-name length, Max size of filename, 5 /// variants(seq-id, data-size, offset, file-size, permission), 1 byte for /// flag, 10 bytes prev seq-id - static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 5 * 10 + 2 + 1 + 10; + static constexpr int64_t kMaxHeader = 1 + 2 + PATH_MAX + 5 * 10 + 1 + 10; /// min number of bytes that must be send to unblock receiver static constexpr int64_t kMinBufLength = 256; /// max size of done command encoding(1 byte for cmd, 1 for status, 10 for diff --git a/test/FileReaderTest.cpp b/test/FileReaderTest.cpp index 5e33b0aa..186dcf1a 100644 --- a/test/FileReaderTest.cpp +++ b/test/FileReaderTest.cpp @@ -50,6 +50,18 @@ class RandomFile { int64_t getSize() const { return fileSize_; } + int32_t getPermission() { + if (permission_ == -1) { + struct stat fileStat; + if (stat(fileName_.c_str(), &fileStat) != 0) { + WLOG(ERROR) << "Error when calling stat()"; + return -1; + } + permission_ = fileStat.st_mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | + S_IRWXG | S_IRWXO); + } + return permission_; + } const string& getFileName() const { return fileName_; } @@ -65,6 +77,7 @@ class RandomFile { private: int64_t fileSize_{-1}; + int32_t permission_{-1}; string fileName_; SourceMetaData* metaData_{nullptr}; }; @@ -98,6 +111,10 @@ void testReadSize(int64_t fileSize, ByteSource& byteSource) { EXPECT_EQ(totalSizeRead, fileSize); } +void testReadPermission(int32_t permission, ByteSource& byteSource) { + EXPECT_EQ(permission, byteSource.getMetaData().permission); +} + void testFileRead(const WdtOptions& options, int64_t fileSize, bool directReads) { RandomFile file(fileSize); @@ -158,6 +175,7 @@ TEST(FileByteSource, FILEINFO_ODIRECT) { ThreadCtx threadCtx(options, true); auto byteSource = Q.getNextSource(&threadCtx, code); testReadSize(sizeToRead, *byteSource); + testReadPermission(file.getPermission(), *byteSource); } TEST(FileByteSource, MULTIPLEFILES_ODIRECT) { @@ -191,6 +209,7 @@ TEST(FileByteSource, MULTIPLEFILES_ODIRECT) { break; } testReadSize(sizeToRead, *byteSource); + testReadPermission(randFiles[fileNumber].getPermission(), *byteSource); ++fileNumber; } EXPECT_EQ(fileNumber, numFiles); @@ -219,6 +238,7 @@ TEST(FileByteSource, MULTIPLEFILES_REGULAR) { Q.setFileInfo(files); Q.buildQueueSynchronously(); ErrorCode code; + int fileNumber = 0; ThreadCtx threadCtx(options, true); while (true) { auto byteSource = Q.getNextSource(&threadCtx, code); @@ -226,6 +246,8 @@ TEST(FileByteSource, MULTIPLEFILES_REGULAR) { break; } testReadSize(sizeToRead, *byteSource); + testReadPermission(randFiles[fileNumber].getPermission(), *byteSource); + ++fileNumber; } } } From 7bb17e30239f921de1d8a285e1852ef84d6a1b0d Mon Sep 17 00:00:00 2001 From: LD Date: Fri, 7 Apr 2017 23:45:34 -0700 Subject: [PATCH 08/12] chmod file to test set-user-ID bit | set-group-ID bit | sticky bit --- build/travis_osx.sh | 1 + test/wdt_e2e_simple_test.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build/travis_osx.sh b/build/travis_osx.sh index 79ddee2f..703f69d6 100755 --- a/build/travis_osx.sh +++ b/build/travis_osx.sh @@ -17,6 +17,7 @@ export PATH=/usr/local/opt/openssl/bin:$CMAKE_BIN_DIR:$HOME/bin:$PATH export LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:$HOME/lib:$LD_LIBRARY_PATH export OPENSSL_ROOT_DIR=/usr/local/opt/openssl export CMAKE_PREFIX_PATH=$HOME +export WDT_TEST_PERMISSION=0 openssl version -a wget https://www.cmake.org/files/v3.6/$CMAKE_BASE.tar.gz tar xfz $CMAKE_BASE.tar.gz diff --git a/test/wdt_e2e_simple_test.sh b/test/wdt_e2e_simple_test.sh index 08ffde25..cad4daa3 100755 --- a/test/wdt_e2e_simple_test.sh +++ b/test/wdt_e2e_simple_test.sh @@ -49,6 +49,15 @@ if [ -z "$WDT_TEST_SYMLINKS" ] ; then fi echo "WDT_TEST_SYMLINKS=$WDT_TEST_SYMLINKS" +# Set WDT_TEST_PERMISSION: +# to 1 : check if permissions match +# to 0 : when "find -printf %m" does not work, i.e. on Mac +if [ -z "$WDT_TEST_PERMISSION" ] ; then + WDT_TEST_PERMISSION=1 + umask 0 +fi +echo "WDT_TEST_PERMISSION=$WDT_TEST_PERMISSION" + # Verbose / to debug failure: #WDTBIN="_bin/wdt/wdt -minloglevel 0 -v 99" # Normal: @@ -96,6 +105,10 @@ do -directory="$DIR/src" -filename="$base.$i" -gen_size_mb="$size" done done + +if [ $WDT_TEST_PERMISSION -eq 1 ]; then + chmod 01777 $DIR/src/inp.0009765625.1 +fi echo "done with setup" if [ $WDT_TEST_SYMLINKS -eq 1 ]; then @@ -137,7 +150,7 @@ if [ $DO_VERIFY -eq 1 ] ; then echo "Should be no diff" (cd $DIR; diff -u src.md5s dst.md5s) STATUS=$? - if [ $STATUS -eq 0 ] ; then + if [ $STATUS -eq 0 ] && [ $WDT_TEST_PERMISSION -eq 1 ]; then (cd $DIR/src ; ( find . -type f -printf %f%m\\n | sort ) > ../src.perm ) (cd $DIR/dst ; ( find . -type f -printf %f%m\\n | sort ) > ../dst.perm ) From 0125fe6ac312ec8f9f637afaec7f5f73f72fe9b7 Mon Sep 17 00:00:00 2001 From: LD Date: Sat, 8 Apr 2017 00:05:16 -0700 Subject: [PATCH 09/12] clang --- ErrorCodes.cpp | 2 +- Protocol.cpp | 2 +- ReceiverThread.cpp | 2 +- Reporting.cpp | 2 +- SenderThread.cpp | 2 +- Throttler.cpp | 2 +- WdtOptions.cpp | 2 +- WdtTransferRequest.cpp | 2 +- WdtTransferRequest.h | 4 ++-- test/FileReaderTest.cpp | 4 ++-- test/ProtocolTest.cpp | 24 +++++++++++------------- util/ClientSocket.cpp | 2 +- util/DirectorySourceQueue.cpp | 10 +++++----- util/EncryptionUtils.cpp | 2 +- util/FileCreator.cpp | 10 +++++----- util/FileCreator.h | 4 ++-- util/FileWriter.cpp | 2 +- util/ServerSocket.cpp | 2 +- util/ThreadTransferHistory.cpp | 2 +- util/ThreadsController.cpp | 2 +- util/WdtFlags.cpp | 2 +- util/WdtSocket.cpp | 2 +- 22 files changed, 43 insertions(+), 45 deletions(-) diff --git a/ErrorCodes.cpp b/ErrorCodes.cpp index 944d503f..66334021 100644 --- a/ErrorCodes.cpp +++ b/ErrorCodes.cpp @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include +#include DEFINE_int32(wdt_double_precision, 2, "Precision while printing double"); diff --git a/Protocol.cpp b/Protocol.cpp index 47574f14..ede3fc07 100644 --- a/Protocol.cpp +++ b/Protocol.cpp @@ -184,7 +184,7 @@ bool Protocol::decodeHeader(int receiverProtocolVersion, char *src, decodeInt64C(br, blockDetails.offset) && decodeInt64C(br, blockDetails.fileSize); if (ok && receiverProtocolVersion >= PRESERVE_PERMISSION) { - ok = decodeInt32C(br, blockDetails.permission); + ok = decodeInt32C(br, blockDetails.permission); } if (ok && receiverProtocolVersion >= HEADER_FLAG_AND_PREV_SEQ_ID_VERSION) { if (br.empty()) { diff --git a/ReceiverThread.cpp b/ReceiverThread.cpp index c870e2fe..d6d3640f 100644 --- a/ReceiverThread.cpp +++ b/ReceiverThread.cpp @@ -6,13 +6,13 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include #include #include #include #include +#include #include namespace facebook { diff --git a/Reporting.cpp b/Reporting.cpp index 94c7cb02..a08f9cf8 100644 --- a/Reporting.cpp +++ b/Reporting.cpp @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include +#include #include #include diff --git a/SenderThread.cpp b/SenderThread.cpp index f5c3c749..0a968d36 100644 --- a/SenderThread.cpp +++ b/SenderThread.cpp @@ -6,7 +6,6 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include #include @@ -14,6 +13,7 @@ #include #include #include +#include #include namespace facebook { diff --git a/Throttler.cpp b/Throttler.cpp index 26cccb8d..1e1cf681 100644 --- a/Throttler.cpp +++ b/Throttler.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include namespace facebook { diff --git a/WdtOptions.cpp b/WdtOptions.cpp index 949f8a36..9decda58 100644 --- a/WdtOptions.cpp +++ b/WdtOptions.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include namespace facebook { namespace wdt { diff --git a/WdtTransferRequest.cpp b/WdtTransferRequest.cpp index d0874667..3ad09a7b 100644 --- a/WdtTransferRequest.cpp +++ b/WdtTransferRequest.cpp @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include +#include #include using namespace std; diff --git a/WdtTransferRequest.h b/WdtTransferRequest.h index 13b7a690..e321dbe2 100644 --- a/WdtTransferRequest.h +++ b/WdtTransferRequest.h @@ -38,8 +38,8 @@ struct WdtFileInfo { /// File permission. int32_t permission; /// Constructor for file info with name, size, odirect request and permission - WdtFileInfo(const std::string& name, - int64_t size, bool directReads, int32_t perm); + WdtFileInfo(const std::string& name, int64_t size, bool directReads, + int32_t perm); /// Constructor for file info with name, size and odirect request WdtFileInfo(const std::string& name, int64_t size, bool directReads); /** diff --git a/test/FileReaderTest.cpp b/test/FileReaderTest.cpp index 186dcf1a..c24f55a8 100644 --- a/test/FileReaderTest.cpp +++ b/test/FileReaderTest.cpp @@ -57,8 +57,8 @@ class RandomFile { WLOG(ERROR) << "Error when calling stat()"; return -1; } - permission_ = fileStat.st_mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | - S_IRWXG | S_IRWXO); + permission_ = fileStat.st_mode & + (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO); } return permission_; } diff --git a/test/ProtocolTest.cpp b/test/ProtocolTest.cpp index a27cb43a..1fbf4a5f 100644 --- a/test/ProtocolTest.cpp +++ b/test/ProtocolTest.cpp @@ -38,9 +38,8 @@ void testHeader() { // and permission BlockDetails nbd; int64_t noff = 0; - bool success = - Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, - sizeof(buf), nbd); + bool success = Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, + noff, sizeof(buf), nbd); EXPECT_TRUE(success); EXPECT_EQ(noff, off); EXPECT_EQ(nbd.fileName, bd.fileName); @@ -52,15 +51,15 @@ void testHeader() { EXPECT_EQ(nbd.permission, bd.permission); noff = 0; // exact size: - success = Protocol::decodeHeader( - Protocol::PRESERVE_PERMISSION, buf, noff, off, nbd); + success = Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, + off, nbd); EXPECT_TRUE(success); WLOG(INFO) << "error tests, expect errors"; // too short noff = 0; - success = Protocol::decodeHeader( - Protocol::PRESERVE_PERMISSION, buf, noff, off - 1, nbd); + success = Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, + off - 1, nbd); EXPECT_FALSE(success); // Long size: @@ -69,7 +68,7 @@ void testHeader() { bd.seqId = 5; bd.offset = 3; bd.fileSize = 128; - bd.permission = 511; // 777 + bd.permission = 511; // 777 bd.allocationStatus = EXISTS_TOO_SMALL; bd.prevSeqId = 10; @@ -80,9 +79,8 @@ void testHeader() { bd.fileName.size() + 1 + 1 + 6 + 1 + 2 + 1 + 1 + 2); // 1 byte variant for id len and size noff = 0; - success = - Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, - sizeof(buf), nbd); + success = Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, + sizeof(buf), nbd); EXPECT_TRUE(success); EXPECT_EQ(noff, off); EXPECT_EQ(nbd.fileName, bd.fileName); @@ -96,8 +94,8 @@ void testHeader() { WLOG(INFO) << "got size of " << nbd.dataSize; // too short for size encoding: noff = 0; - success = Protocol::decodeHeader( - Protocol::PRESERVE_PERMISSION, buf, noff, off - 2, nbd); + success = Protocol::decodeHeader(Protocol::PRESERVE_PERMISSION, buf, noff, + off - 2, nbd); EXPECT_FALSE(success); } diff --git a/util/ClientSocket.cpp b/util/ClientSocket.cpp index 496779d5..c5e40ddb 100644 --- a/util/ClientSocket.cpp +++ b/util/ClientSocket.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/DirectorySourceQueue.cpp b/util/DirectorySourceQueue.cpp index 794578c9..5f7e751a 100644 --- a/util/DirectorySourceQueue.cpp +++ b/util/DirectorySourceQueue.cpp @@ -33,9 +33,9 @@ WdtFileInfo::WdtFileInfo(const string &name, int64_t size, bool doDirectReads) : fileName(name), fileSize(size), directReads(doDirectReads) { } -WdtFileInfo::WdtFileInfo(const string &name, - int64_t size, bool doDirectReads, int32_t perm) - : WdtFileInfo(name, size, doDirectReads){ +WdtFileInfo::WdtFileInfo(const string &name, int64_t size, bool doDirectReads, + int32_t perm) + : WdtFileInfo(name, size, doDirectReads) { permission = perm; } @@ -372,8 +372,8 @@ bool DirectorySourceQueue::explore() { continue; } const int perm = getPermission(fileStat.st_mode); - WdtFileInfo fileInfo(newRelativePath, - fileStat.st_size, directReads_, perm); + WdtFileInfo fileInfo(newRelativePath, fileStat.st_size, directReads_, + perm); createIntoQueue(newFullPath, fileInfo); continue; } diff --git a/util/EncryptionUtils.cpp b/util/EncryptionUtils.cpp index f8f747f3..45591f3b 100644 --- a/util/EncryptionUtils.cpp +++ b/util/EncryptionUtils.cpp @@ -6,11 +6,11 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include #include // for humanify #include // for to/fromHex utils +#include #include #include diff --git a/util/FileCreator.cpp b/util/FileCreator.cpp index f1b9910d..f36066a5 100644 --- a/util/FileCreator.cpp +++ b/util/FileCreator.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include @@ -58,8 +58,8 @@ int FileCreator::openAndSetSize(ThreadCtx &threadCtx, const bool doCreate = (blockDetails->allocationStatus == NOT_EXISTS); const bool isTooLarge = (blockDetails->allocationStatus == EXISTS_TOO_LARGE); if (doCreate) { - fd = createFile(threadCtx, - blockDetails->fileName, blockDetails->permission); + fd = + createFile(threadCtx, blockDetails->fileName, blockDetails->permission); } else { fd = openExistingFile(threadCtx, blockDetails->fileName); } @@ -198,8 +198,8 @@ int FileCreator::openExistingFile(ThreadCtx &threadCtx, return res; } -int FileCreator::createFile(ThreadCtx &threadCtx, - const string &relPathStr, int32_t permission) { +int FileCreator::createFile(ThreadCtx &threadCtx, const string &relPathStr, + int32_t permission) { CHECK(!relPathStr.empty()); CHECK(relPathStr[0] != '/'); CHECK(relPathStr.back() != '/'); diff --git a/util/FileCreator.h b/util/FileCreator.h index 5c0e8143..5e277715 100644 --- a/util/FileCreator.h +++ b/util/FileCreator.h @@ -108,8 +108,8 @@ class FileCreator { * * @return file descriptor or -1 on error */ - int createFile(ThreadCtx &threadCtx, - const std::string &relPath, int32_t permission); + int createFile(ThreadCtx &threadCtx, const std::string &relPath, + int32_t permission); /** * Open existing file */ diff --git a/util/FileWriter.cpp b/util/FileWriter.cpp index 68b8fb55..b3ea00c1 100644 --- a/util/FileWriter.cpp +++ b/util/FileWriter.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/ServerSocket.cpp b/util/ServerSocket.cpp index f6109c17..6e692ee0 100644 --- a/util/ServerSocket.cpp +++ b/util/ServerSocket.cpp @@ -6,12 +6,12 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include #include #include #include #include +#include #include namespace facebook { namespace wdt { diff --git a/util/ThreadTransferHistory.cpp b/util/ThreadTransferHistory.cpp index 59b0ad94..9f2d129c 100644 --- a/util/ThreadTransferHistory.cpp +++ b/util/ThreadTransferHistory.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include namespace facebook { namespace wdt { diff --git a/util/ThreadsController.cpp b/util/ThreadsController.cpp index da1119ae..0dbc80a4 100644 --- a/util/ThreadsController.cpp +++ b/util/ThreadsController.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include using namespace std; diff --git a/util/WdtFlags.cpp b/util/WdtFlags.cpp index ec51f2de..b22dedd4 100644 --- a/util/WdtFlags.cpp +++ b/util/WdtFlags.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/WdtSocket.cpp b/util/WdtSocket.cpp index f8043d24..90d855e4 100644 --- a/util/WdtSocket.cpp +++ b/util/WdtSocket.cpp @@ -1,10 +1,10 @@ -#include #include #include // for humanify #include #include #include #include +#include #ifdef WDT_HAS_SOCKIOS_H #include #endif From b57a4fc48c9d2a7f09b99605f433ee1c9c35324e Mon Sep 17 00:00:00 2001 From: LD Date: Sat, 22 Apr 2017 21:32:53 -0700 Subject: [PATCH 10/12] revert includes that cause FB lint problem --- ErrorCodes.cpp | 2 +- ReceiverThread.cpp | 2 +- Reporting.cpp | 2 +- SenderThread.cpp | 2 +- Throttler.cpp | 2 +- WdtOptions.cpp | 2 +- WdtTransferRequest.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ErrorCodes.cpp b/ErrorCodes.cpp index 66334021..944d503f 100644 --- a/ErrorCodes.cpp +++ b/ErrorCodes.cpp @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include -#include DEFINE_int32(wdt_double_precision, 2, "Precision while printing double"); diff --git a/ReceiverThread.cpp b/ReceiverThread.cpp index d6d3640f..c870e2fe 100644 --- a/ReceiverThread.cpp +++ b/ReceiverThread.cpp @@ -6,13 +6,13 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include #include #include #include #include -#include #include namespace facebook { diff --git a/Reporting.cpp b/Reporting.cpp index a08f9cf8..94c7cb02 100644 --- a/Reporting.cpp +++ b/Reporting.cpp @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include -#include #include #include diff --git a/SenderThread.cpp b/SenderThread.cpp index 0a968d36..f5c3c749 100644 --- a/SenderThread.cpp +++ b/SenderThread.cpp @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include #include @@ -13,7 +14,6 @@ #include #include #include -#include #include namespace facebook { diff --git a/Throttler.cpp b/Throttler.cpp index 1e1cf681..26cccb8d 100644 --- a/Throttler.cpp +++ b/Throttler.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include namespace facebook { diff --git a/WdtOptions.cpp b/WdtOptions.cpp index 9decda58..949f8a36 100644 --- a/WdtOptions.cpp +++ b/WdtOptions.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include namespace facebook { namespace wdt { diff --git a/WdtTransferRequest.cpp b/WdtTransferRequest.cpp index 3ad09a7b..d0874667 100644 --- a/WdtTransferRequest.cpp +++ b/WdtTransferRequest.cpp @@ -6,9 +6,9 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include -#include #include using namespace std; From caf98ff59c03595218e9bd369d98c76d80fa1491 Mon Sep 17 00:00:00 2001 From: LD Date: Thu, 27 Apr 2017 10:17:08 -0700 Subject: [PATCH 11/12] more reverts to avoid FB lint problem --- util/ClientSocket.cpp | 2 +- util/EncryptionUtils.cpp | 2 +- util/FileCreator.cpp | 2 +- util/FileWriter.cpp | 2 +- util/ServerSocket.cpp | 2 +- util/ThreadsController.cpp | 2 +- util/WdtFlags.cpp | 2 +- util/WdtSocket.cpp | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/util/ClientSocket.cpp b/util/ClientSocket.cpp index c5e40ddb..496779d5 100644 --- a/util/ClientSocket.cpp +++ b/util/ClientSocket.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/EncryptionUtils.cpp b/util/EncryptionUtils.cpp index 45591f3b..f8f747f3 100644 --- a/util/EncryptionUtils.cpp +++ b/util/EncryptionUtils.cpp @@ -6,11 +6,11 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include #include // for humanify #include // for to/fromHex utils -#include #include #include diff --git a/util/FileCreator.cpp b/util/FileCreator.cpp index f36066a5..e36c2562 100644 --- a/util/FileCreator.cpp +++ b/util/FileCreator.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/FileWriter.cpp b/util/FileWriter.cpp index b3ea00c1..68b8fb55 100644 --- a/util/FileWriter.cpp +++ b/util/FileWriter.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/ServerSocket.cpp b/util/ServerSocket.cpp index 6e692ee0..f6109c17 100644 --- a/util/ServerSocket.cpp +++ b/util/ServerSocket.cpp @@ -6,12 +6,12 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include #include #include #include #include #include -#include #include namespace facebook { namespace wdt { diff --git a/util/ThreadsController.cpp b/util/ThreadsController.cpp index 0dbc80a4..da1119ae 100644 --- a/util/ThreadsController.cpp +++ b/util/ThreadsController.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include using namespace std; diff --git a/util/WdtFlags.cpp b/util/WdtFlags.cpp index b22dedd4..ec51f2de 100644 --- a/util/WdtFlags.cpp +++ b/util/WdtFlags.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include #include #include diff --git a/util/WdtSocket.cpp b/util/WdtSocket.cpp index 90d855e4..f8043d24 100644 --- a/util/WdtSocket.cpp +++ b/util/WdtSocket.cpp @@ -1,10 +1,10 @@ +#include #include #include // for humanify #include #include #include #include -#include #ifdef WDT_HAS_SOCKIOS_H #include #endif From ae240d9a97c437da201c3b81505d653a1537a646 Mon Sep 17 00:00:00 2001 From: LD Date: Thu, 27 Apr 2017 10:26:34 -0700 Subject: [PATCH 12/12] merge conflicts --- CMakeLists.txt | 2 +- WdtConfig.h | 4 ++-- util/ThreadTransferHistory.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79ff4d51..0ad0a202 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.2) # There is no C per se in WDT but if you use CXX only here many checks fail # Version is Major.Minor.YYMMDDX for up to 10 releases per day (X from 0 to 9) # Minor currently is also the protocol version - has to match with Protocol.cpp -project("WDT" LANGUAGES C CXX VERSION 1.31.1703310) +project("WDT" LANGUAGES C CXX VERSION 1.31.1704270) # On MacOS this requires the latest (master) CMake (and/or CMake 3.1.1/3.2) # WDT itself works fine with C++11 (gcc 4.8 for instance) but more recent folly diff --git a/WdtConfig.h b/WdtConfig.h index 6cf78d5c..4dc1e42c 100644 --- a/WdtConfig.h +++ b/WdtConfig.h @@ -11,9 +11,9 @@ #define WDT_VERSION_MAJOR 1 #define WDT_VERSION_MINOR 31 -#define WDT_VERSION_BUILD 1703310 +#define WDT_VERSION_BUILD 1704270 // Add -fbcode to version str -#define WDT_VERSION_STR "1.31.1703310-fbcode" +#define WDT_VERSION_STR "1.31.1704270-fbcode" // Tie minor and proto version #define WDT_PROTOCOL_VERSION WDT_VERSION_MINOR diff --git a/util/ThreadTransferHistory.cpp b/util/ThreadTransferHistory.cpp index 9f2d129c..59b0ad94 100644 --- a/util/ThreadTransferHistory.cpp +++ b/util/ThreadTransferHistory.cpp @@ -6,8 +6,8 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ -#include #include +#include namespace facebook { namespace wdt {