diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml index 6a0754178364f..ef4ac5cb8f783 100644 --- a/.github/workflows/clang-tidy-review.yml +++ b/.github/workflows/clang-tidy-review.yml @@ -9,7 +9,7 @@ on: jobs: clang-tidy: runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/linux-clang-compile-tests.yml b/.github/workflows/linux-clang-compile-tests.yml index ce963b813e47b..2f93a3d0176a7 100644 --- a/.github/workflows/linux-clang-compile-tests.yml +++ b/.github/workflows/linux-clang-compile-tests.yml @@ -8,7 +8,7 @@ jobs: build: name: Linux Clang compilation and tests runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/linux-gcc-compile-tests.yml b/.github/workflows/linux-gcc-compile-tests.yml index 7beb6022f30f5..ad6b086126137 100644 --- a/.github/workflows/linux-gcc-compile-tests.yml +++ b/.github/workflows/linux-gcc-compile-tests.yml @@ -8,7 +8,7 @@ jobs: build: name: Linux GCC compilation and tests runs-on: ubuntu-latest - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index a8ab9e57a5790..d5f23cc243735 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -8,7 +8,7 @@ jobs: build: name: SonarCloud analysis runs-on: [ubuntu-latest, self-hosted] - container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-forky-6.9.2-3 + container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-sid-6.10.2-1 env: SONAR_SERVER_URL: "https://sonarcloud.io" BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp index 6f7c632f774a2..3bc0ec9306139 100644 --- a/src/gui/folderwatcher.cpp +++ b/src/gui/folderwatcher.cpp @@ -113,8 +113,8 @@ void FolderWatcher::performSetPermissionsTest(const QString &path) if (!QFile::exists(path)) { QFile f(path); - f.open(QIODevice::WriteOnly); - if (!f.isOpen()) { + const auto openResult = f.open(QIODevice::WriteOnly); + if (!openResult || !f.isOpen()) { qCWarning(lcFolderWatcher()) << "Failed to create test file: " << path; return; } @@ -158,7 +158,11 @@ void FolderWatcher::startNotificationTestWhenReady() FileSystem::setModTime(path, mtime + 1); } else { QFile f(path); - f.open(QIODevice::WriteOnly | QIODevice::Append); + const auto openResult = f.open(QIODevice::WriteOnly | QIODevice::Append); + if (!openResult || !f.isOpen()) { + qCWarning(lcFolderWatcher()) << "Failed to create test file: " << path; + return; + } } FileSystem::setFileHidden(path, true); diff --git a/src/gui/syncrunfilelog.cpp b/src/gui/syncrunfilelog.cpp index 828b9a4f37005..abf05a3c4f21a 100644 --- a/src/gui/syncrunfilelog.cpp +++ b/src/gui/syncrunfilelog.cpp @@ -37,7 +37,10 @@ void SyncRunFileLog::start(const QString &folderPath) while (FileSystem::fileExists(filename)) { QFile file(filename); - file.open(QIODevice::ReadOnly| QIODevice::Text); + const auto openResult = file.open(QIODevice::ReadOnly| QIODevice::Text); + if (!openResult) { + qWarning() << "error while opening the file" << filename; + } QTextStream in(&file); QString line = in.readLine(); @@ -66,7 +69,10 @@ void SyncRunFileLog::start(const QString &folderPath) } _file.reset(new QFile(filename)); - _file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text); + const auto openResult = _file->open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text); + if (!openResult) { + qWarning() << "error while opening the file" << filename; + } _out.setDevice(_file.data()); diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index 1e4388c84eac8..4d8e42de17a4d 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -400,7 +400,10 @@ void NSISUpdater::versionInfoArrived(const UpdateInfo &info) setDownloadState(Downloading); _file.reset(new QTemporaryFile); _file->setAutoRemove(true); - _file->open(); + const auto openResult = _file->open(); + if (!openResult) { + qCWarning(lcUpdater()) << "error while opening the temporary file"; + } } } } diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index cc8dd7b14152d..7fa046c4a56fa 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -411,7 +411,11 @@ QString subjectInfoHelper(const QSslCertificate &cert, const QByteArray &qa) void OwncloudSetupPage::slotCertificateAccepted() { QFile certFile(addCertDial->getCertificatePath()); - certFile.open(QFile::ReadOnly); + const auto openResult = certFile.open(QFile::ReadOnly); + if (!openResult) { + qWarning() << "Failed to open certificate file:" << addCertDial->getCertificatePath(); + return; + } QByteArray certData = certFile.readAll(); QByteArray certPassword = addCertDial->getCertificatePasswd().toLocal8Bit(); diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 693c1bcee16b1..cc8c83cd542e8 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -2488,8 +2488,17 @@ bool EncryptionHelper::fileEncryption(const QByteArray &key, const QByteArray &i bool EncryptionHelper::fileDecryption(const QByteArray &key, const QByteArray& iv, QFile *input, QFile *output) { - input->open(QIODevice::ReadOnly); - output->open(QIODevice::WriteOnly); + const auto inputOpenResult = input->open(QIODevice::ReadOnly); + if (!inputOpenResult) { + qCWarning(lcCse()) << "Failed to open input file"; + return false; + } + + const auto outputOpenResult = output->open(QIODevice::WriteOnly); + if (!outputOpenResult) { + qCWarning(lcCse()) << "Failed to open output file"; + return false; + } // Init CipherCtx ctx; diff --git a/test/syncenginetestutils.cpp b/test/syncenginetestutils.cpp index 0d369026d7733..bd6a7d441ce02 100644 --- a/test/syncenginetestutils.cpp +++ b/test/syncenginetestutils.cpp @@ -71,7 +71,10 @@ void DiskFileModifier::insert(const QString &relativePath, qint64 size, char con if (!file.exists()) { QVERIFY(!file.exists()); } - file.open(QFile::WriteOnly); + const auto openResult = file.open(QFile::WriteOnly); + if (!openResult) { + qWarning() << "error while opening the file" << relativePath << _rootDir.filePath(relativePath); + } QByteArray buf(1024, contentChar); for (int x = 0; x < size / buf.size(); ++x) { file.write(buf); @@ -90,7 +93,10 @@ void DiskFileModifier::setContents(const QString &relativePath, char contentChar QFile file { _rootDir.filePath(relativePath) }; QVERIFY(file.exists()); qint64 size = file.size(); - file.open(QFile::WriteOnly); + const auto openResult = file.open(QFile::WriteOnly); + if (!openResult) { + qWarning() << "error while opening the file" << relativePath << _rootDir.filePath(relativePath); + } file.write(QByteArray {}.fill(contentChar, size)); } @@ -98,7 +104,10 @@ void DiskFileModifier::appendByte(const QString &relativePath) { QFile file { _rootDir.filePath(relativePath) }; QVERIFY(file.exists()); - file.open(QFile::ReadWrite); + const auto openResult = file.open(QFile::ReadWrite); + if (!openResult) { + qWarning() << "error while opening the file" << relativePath << _rootDir.filePath(relativePath); + } QByteArray contents = file.read(1); file.seek(file.size()); file.write(contents); @@ -1455,7 +1464,10 @@ void FakeFolder::toDisk(QDir &dir, const FileInfo &templateFi) toDisk(subDir, child); } else { QFile file { dir.filePath(child.name) }; - file.open(QFile::WriteOnly); + const auto openResult = file.open(QFile::WriteOnly); + if (!openResult) { + qWarning() << "error while opening the file" << child.name << dir.filePath(child.name); + } file.write(QByteArray {}.fill(child.contentChar, child.size)); file.close(); OCC::FileSystem::setModTime(file.fileName(), OCC::Utility::qDateTimeToTime_t(child.lastModified)); @@ -1474,7 +1486,10 @@ void FakeFolder::fromDisk(QDir &dir, FileInfo &templateFi) fromDisk(subDir, subFi); } else { QFile f { diskChild.filePath() }; - f.open(QFile::ReadOnly); + const auto openResult = f.open(QFile::ReadOnly); + if (!openResult) { + qWarning() << "error while opening the file" << diskChild.filePath(); + } auto content = f.read(1); if (content.size() == 0) { qWarning() << "Empty file at:" << diskChild.filePath(); diff --git a/test/testfolderman.cpp b/test/testfolderman.cpp index 79eef977cd8bc..41c8e4c002b44 100644 --- a/test/testfolderman.cpp +++ b/test/testfolderman.cpp @@ -281,7 +281,11 @@ private slots: QVERIFY(dir2.mkpath("free2/sub")); { QFile f(dir.path() + "/sub/file.txt"); - f.open(QFile::WriteOnly); + const auto openResult = f.open(QFile::WriteOnly); + if (!openResult) { + qWarning() << "Failed to create file:" << dir.path() + "/sub/file.txt"; + return; + } f.write("hello"); } QString dirPath = dir2.canonicalPath(); diff --git a/test/testlockfile.cpp b/test/testlockfile.cpp index 3afcbe738db5f..5d1172f182194 100644 --- a/test/testlockfile.cpp +++ b/test/testlockfile.cpp @@ -938,7 +938,11 @@ private slots: QVERIFY(fakeFolder.syncJournal().setFileRecord(record)); qDebug() << fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s; QFile newLockFile(fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s); - newLockFile.open(QFile::OpenModeFlag::NewOnly); + const auto openResult = newLockFile.open(QFile::OpenModeFlag::NewOnly); + if (!openResult) { + qWarning() << "Failed to create lock file:" << fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s; + return; + } OCC::FileSystem::setFileHidden(fakeFolder.localPath() + u"parent/child/.~lock.hello.odt#"_s, true); fakeFolder.remoteModifier().remove(u"parent/child"_s);