From 450815261afde625a16bcdb54f44b9300a90f2f4 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 5 Jul 2022 19:09:31 +0200 Subject: [PATCH 1/6] switch to using the main client CI image based on ubuntu 22.04 will get an upgraded openssl will get an upgraded Qt Signed-off-by: Matthieu Gallien --- .drone.yml | 20 ++++++++++---------- .github/workflows/sonarcloud.yml | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1ffef5c66ef2b..00000e3e25623 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,23 +3,23 @@ name: qt-5.15 steps: - name: cmake - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build commands: - cd /drone/build - - cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src + - cmake -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src - name: compile - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build commands: - cd /drone/build - - make -j$(nproc) + - ninja - name: test - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build @@ -47,15 +47,15 @@ name: qt-5.15-clang steps: - name: cmake - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build commands: - cd /drone/build - - cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src + - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src - name: compile - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build @@ -63,7 +63,7 @@ steps: - cd /drone/build - ninja - name: test - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build @@ -73,7 +73,7 @@ steps: - chown -R test:test . - su -c 'ASAN_OPTIONS=detect_leaks=0 xvfb-run ctest --output-on-failure' test - name: clang-tidy - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 volumes: - name: build path: /drone/build diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 4843f25b6a0b5..c607407ab9671 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -9,7 +9,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4 + container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 env: SONAR_SERVER_URL: "https://sonarcloud.io" BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed @@ -28,8 +28,8 @@ jobs: run: | mkdir build cd build - cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DBUILD_COVERAGE=ON - build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -j 2 + cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DBUILD_COVERAGE=ON + build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja - name: Run tests run: | cd build From fe7a62bc77298ad8dfd6c12fc6bfe0d02ca12762 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 28 Jul 2022 14:11:06 +0200 Subject: [PATCH 2/6] remove variables set but never read will fix a clang compilation error Signed-off-by: Matthieu Gallien --- src/gui/sharelinkwidget.cpp | 3 --- src/libsync/clientsideencryption.cpp | 8 -------- 2 files changed, 11 deletions(-) diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 09186e9723d9c..cc3a0952ce287 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -82,13 +82,10 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, _ui->errorLabel->hide(); - auto sharingPossible = true; if (!_account->capabilities().sharePublicLink()) { qCWarning(lcShareLink) << "Link shares have been disabled"; - sharingPossible = false; } else if (!(maxSharingPermissions & SharePermissionShare)) { qCWarning(lcShareLink) << "The file can not be shared because it was shared without sharing permission."; - sharingPossible = false; } _ui->enableShareLink->setChecked(false); diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 7a923e490e464..3a75707f5b4da 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -1656,7 +1656,6 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i QByteArray out(blockSize + OCC::Constants::e2EeTagSize - 1, '\0'); int len = 0; - int total_len = 0; qCDebug(lcCse) << "Starting to encrypt the file" << input->fileName() << input->atEnd(); while(!input->atEnd()) { @@ -1673,7 +1672,6 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i } output->write(out, len); - total_len += len; } if(1 != EVP_EncryptFinal_ex(ctx, unsignedData(out), &len)) { @@ -1681,7 +1679,6 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i return false; } output->write(out, len); - total_len += len; /* Get the e2EeTag */ QByteArray e2EeTag(OCC::Constants::e2EeTagSize, '\0'); @@ -1865,7 +1862,6 @@ QByteArray EncryptionHelper::StreamingDecryptor::chunkDecryption(const char *inp return QByteArray(); } - qint64 bytesWritten = 0; qint64 inputPos = 0; QByteArray decryptedBlock(blockSize + OCC::Constants::e2EeTagSize - 1, '\0'); @@ -1894,8 +1890,6 @@ QByteArray EncryptionHelper::StreamingDecryptor::chunkDecryption(const char *inp return QByteArray(); } - bytesWritten += writtenToOutput; - // advance input position for further read inputPos += encryptedBlock.size(); @@ -1934,8 +1928,6 @@ QByteArray EncryptionHelper::StreamingDecryptor::chunkDecryption(const char *inp return QByteArray(); } - bytesWritten += writtenToOutput; - _decryptedSoFar += OCC::Constants::e2EeTagSize; _isFinished = true; From 7180b09807f37c9cee674aa3a61f938f3601c7d8 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Thu, 28 Jul 2022 16:10:37 +0200 Subject: [PATCH 3/6] mark unused variable as bein unused to avoid clang warning Signed-off-by: Matthieu Gallien --- src/gui/creds/webflowcredentials.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/creds/webflowcredentials.cpp b/src/gui/creds/webflowcredentials.cpp index 2b7ea3eec4a45..278d81b94cc18 100644 --- a/src/gui/creds/webflowcredentials.cpp +++ b/src/gui/creds/webflowcredentials.cpp @@ -150,6 +150,7 @@ void WebFlowCredentials::askFromUser() { #ifdef WITH_WEBENGINE bool useFlow2 = (type != DetermineAuthTypeJob::WebViewFlow); #else // WITH_WEBENGINE + Q_UNUSED(type) bool useFlow2 = true; #endif // WITH_WEBENGINE From 0ad5e568efcd5147e4eea722de538109ea71545a Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 2 Aug 2022 10:43:09 +0200 Subject: [PATCH 4/6] use latest CI images for general CI and AppImage CI Signed-off-by: Matthieu Gallien --- .drone.yml | 16 ++++++++-------- .github/workflows/sonarcloud.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index 00000e3e25623..ab64a0d135e31 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,7 +3,7 @@ name: qt-5.15 steps: - name: cmake - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -11,7 +11,7 @@ steps: - cd /drone/build - cmake -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src - name: compile - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -19,7 +19,7 @@ steps: - cd /drone/build - ninja - name: test - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -47,7 +47,7 @@ name: qt-5.15-clang steps: - name: cmake - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -55,7 +55,7 @@ steps: - cd /drone/build - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src - name: compile - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -63,7 +63,7 @@ steps: - cd /drone/build - ninja - name: test - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -73,7 +73,7 @@ steps: - chown -R test:test . - su -c 'ASAN_OPTIONS=detect_leaks=0 xvfb-run ctest --output-on-failure' test - name: clang-tidy - image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: - name: build path: /drone/build @@ -98,7 +98,7 @@ name: AppImage steps: - name: build - image: ghcr.io/nextcloud/continuous-integration-client-appimage:client-appimage-3 + image: ghcr.io/nextcloud/continuous-integration-client-appimage:client-appimage-4 environment: CI_UPLOAD_GIT_TOKEN: from_secret: CI_UPLOAD_GIT_TOKEN diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index c607407ab9671..d89b1a86f6010 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -9,7 +9,7 @@ jobs: build: name: Build runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-7 + container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 env: SONAR_SERVER_URL: "https://sonarcloud.io" BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed From 6f054113e5aaad83bf5b73183625b9682782a4ee Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 2 Aug 2022 11:28:47 +0200 Subject: [PATCH 5/6] modern OpenSSL may install files in /usr/local/lib64 Signed-off-by: Matthieu Gallien --- admin/linux/build-appimage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/linux/build-appimage.sh b/admin/linux/build-appimage.sh index ac124872bf31e..d9d18143b10b0 100755 --- a/admin/linux/build-appimage.sh +++ b/admin/linux/build-appimage.sh @@ -84,8 +84,8 @@ cp ./usr/share/icons/hicolor/512x512/apps/*.png . # Workaround for linuxeployqt # Because distros need to get their shit together cp -R /usr/lib/x86_64-linux-gnu/libssl.so* ./usr/lib/ cp -R /usr/lib/x86_64-linux-gnu/libcrypto.so* ./usr/lib/ -cp -P /usr/local/lib/libssl.so* ./usr/lib/ -cp -P /usr/local/lib/libcrypto.so* ./usr/lib/ +cp -P /usr/local/lib*/libssl.so* ./usr/lib/ +cp -P /usr/local/lib*/libcrypto.so* ./usr/lib/ # NSS fun cp -P -r /usr/lib/x86_64-linux-gnu/nss ./usr/lib/ From 81ff8612ad6b8a9cf165bfebb7bf5ec42f7c229b Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 2 Aug 2022 13:59:02 +0200 Subject: [PATCH 6/6] add explicit OpenSSL path when calling cmake to be able to find it Signed-off-by: Matthieu Gallien --- .drone.yml | 4 ++-- .github/workflows/sonarcloud.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index ab64a0d135e31..72c474c5d46b7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,7 +9,7 @@ steps: path: /drone/build commands: - cd /drone/build - - cmake -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src + - cmake -G Ninja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 ../src - name: compile image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: @@ -53,7 +53,7 @@ steps: path: /drone/build commands: - cd /drone/build - - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src + - cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-14 -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 ../src - name: compile image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-8 volumes: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index d89b1a86f6010..c2f8386992101 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -28,7 +28,7 @@ jobs: run: | mkdir build cd build - cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DBUILD_COVERAGE=ON + cmake .. -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DBUILD_COVERAGE=ON -DOPENSSL_ROOT_DIR=/usr/local/lib64 build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja - name: Run tests run: |