diff --git a/.github/workflows/gcc11.yml b/.github/workflows/gcc11.yml new file mode 100644 index 0000000..e82094f --- /dev/null +++ b/.github/workflows/gcc11.yml @@ -0,0 +1,29 @@ +name: gcc 11 + +on: [push, pull_request] + + +jobs: + build: + name: Compiles with gcc 11 + runs-on: ubuntu-20.04 + + steps: + - name: checkout + uses: actions/checkout@v2 + - name: install packages + run: sudo apt install build-essential nettle-dev time gcc-11 g++-11 + - name: bootstrap + run: ./bootstrap.sh + - name: configure + run: ./configure CXX=g++-11 + - name: build + run: make + - name: check + run: make check + - name: store the logs as an artifact + if: ${{ always() }} + uses: actions/upload-artifact@v2.2.4 + with: + path: '**/*.log' + diff --git a/lgtm.yml b/lgtm.yml index 6b1ff87..a159312 100644 --- a/lgtm.yml +++ b/lgtm.yml @@ -6,6 +6,5 @@ extraction: - nettle-dev configure: command: - - grep -v AX_CXX_COMPILE_STDCXX tmp && mv tmp configure.ac - ./bootstrap.sh - ./configure diff --git a/rdfind.cc b/rdfind.cc index fbd6cb8..cd35314 100644 --- a/rdfind.cc +++ b/rdfind.cc @@ -9,6 +9,7 @@ // std #include #include +#include #include #include @@ -60,7 +61,7 @@ usage() << " -followsymlinks true |(false) follow symlinks\n" << " -removeidentinode (true)| false ignore files with nonunique " "device and inode\n" - << " -checksum md5 |(sha1)| sha256\n" + << " -checksum md5 |(sha1)| sha256 | none\n" << " checksum type\n" << " -deterministic (true)| false makes results independent of order\n" << " from listing the filesystem\n" @@ -102,6 +103,7 @@ struct Options bool followsymlinks = false; // follow symlinks bool dryrun = false; // only dryrun, don't destroy anything bool remove_identical_inode = true; // remove files with identical inodes + bool checksum = true; // use some checksum bool usemd5 = false; // use md5 checksum to check for similarity bool usesha1 = false; // use sha1 checksum to check for similarity bool usesha256 = false; // use sha256 checksum to check for similarity @@ -173,8 +175,10 @@ parseOptions(Parser& parser) o.usesha1 = true; } else if (parser.parsed_string_is("sha256")) { o.usesha256 = true; + } else if (parser.parsed_string_is("none")) { + o.checksum = false; } else { - std::cerr << "expected md5/sha1/sha256, not \"" + std::cerr << "expected md5/sha1/sha256/none, not \"" << parser.get_parsed_string() << "\"\n"; std::exit(EXIT_FAILURE); } @@ -236,8 +240,10 @@ parseOptions(Parser& parser) // done with parsing of options. remaining arguments are files and dirs. // decide what checksum to use - if no checksum is set, force sha1! - if (!o.usemd5 && !o.usesha1 && !o.usesha256) { - o.usesha1 = true; + if (o.checksum) { + if (!o.usemd5 && !o.usesha1 && !o.usesha256) { + o.usesha1 = true; + } } return o; } @@ -355,17 +361,19 @@ main(int narg, const char* argv[]) { Fileinfo::readtobuffermode::READ_FIRST_BYTES, "first bytes" }, { Fileinfo::readtobuffermode::READ_LAST_BYTES, "last bytes" }, }; - if (o.usemd5) { - modes.emplace_back(Fileinfo::readtobuffermode::CREATE_MD5_CHECKSUM, - "md5 checksum"); - } - if (o.usesha1) { - modes.emplace_back(Fileinfo::readtobuffermode::CREATE_SHA1_CHECKSUM, - "sha1 checksum"); - } - if (o.usesha256) { - modes.emplace_back(Fileinfo::readtobuffermode::CREATE_SHA256_CHECKSUM, - "sha256 checksum"); + if (o.checksum) { + if (o.usemd5) { + modes.emplace_back(Fileinfo::readtobuffermode::CREATE_MD5_CHECKSUM, + "md5 checksum"); + } + if (o.usesha1) { + modes.emplace_back(Fileinfo::readtobuffermode::CREATE_SHA1_CHECKSUM, + "sha1 checksum"); + } + if (o.usesha256) { + modes.emplace_back(Fileinfo::readtobuffermode::CREATE_SHA256_CHECKSUM, + "sha256 checksum"); + } } for (auto it = modes.begin() + 1; it != modes.end(); ++it) {