Many files have no UserMetaData attributes set at all, or only a subset
of the available ones. Allow to bulk query which attributes are set to
short cut the one-by-one query.
Details
- Reviewers
astippich ngraham - Group Reviewers
Baloo Frameworks - Commits
- R286:bbb05dfe7f9f: [UserMetaData] Add method to query which attributes are set
ctest (on Linux)
Code paths for Mac and FreeBSD are fully implemented, but untested. The
Windows implementation is mostly a stub, but functional conforming with
the documentation.
Diff Detail
- Repository
- R286 KFileMetaData
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
src/xattr_p.h | ||
---|---|---|
231 | Why ditto? |
It compiles now, but the test fails:
********* Start testing of UserMetaDataWriterTest ********* Config: Using QtTest library 5.12.2, Qt 5.12.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 8.0.0 (tags/RELEASE_800/final 356365)) PASS : UserMetaDataWriterTest::initTestCase() FAIL! : UserMetaDataWriterTest::test() 'md.queryAttributes(UserMetaData::Attribute::All) & UserMetaData::Attribute::Tags' returned FALSE. () Loc: [/home/arr/projects/kfilemetadata/autotests/usermetadatawritertest.cpp(55)] PASS : UserMetaDataWriterTest::cleanupTestCase() Totals: 2 passed, 1 failed, 0 skipped, 0 blacklisted, 1ms ********* Finished testing of UserMetaDataWriterTest *********
I also had to do this to enable the test:
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 49824ba..994c7bc 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -220,7 +220,7 @@ endif() # # UserMetaData # -if(CMAKE_SYSTEM_NAME MATCHES "Linux") +if(UNIX) kde_enable_exceptions() ecm_add_test(usermetadatawritertest.cpp ../src/usermetadata.cpp TEST_NAME "usermetadatawritertest"
src/xattr_p.h | ||
---|---|---|
231 | Right, no need to change there. |
Apparently, the usermetadatawritertest was not executed on *BSD before, can you check if the test succeeds on the old code?
Please submit a PR with the Linux -> UNIX change, and make this one a dependency of it.
Yep, it works on master.
The output with qDebug()s:
PASS : UserMetaDataWriterTest::initTestCase() QDEBUG : UserMetaDataWriterTest::test() extattr_list size: 14 QDEBUG : UserMetaDataWriterTest::test() extattr_list size: 14 QDEBUG : UserMetaDataWriterTest::test() extattr_list r: 14 "\ruser.xdg.tags" FAIL! : UserMetaDataWriterTest::test() 'md.queryAttributes(UserMetaData::Attribute::All) & UserMetaData::Attribute::Tags' returned FALSE. () Loc: [/home/arr/projects/kfilemetadata/autotests/usermetadatawritertest.cpp(55)]
Unfortunately, the returned format is different:
https://www.freebsd.org/cgi/man.cgi?query=extattr_list_file&sektion=2&apropos=0&manpath=FreeBSD+10.0-RELEASE
Each list entry consists of a single byte containing the length of the attribute name, followed by the attribute name. The attribute name is not terminated by ASCII 0 (nul).
FreeBSD and WIndows folks had their chance to speak up - Windows will just have to wait for the CI ...
FreeBSD has been reviewed, @arrowd - Thanks!
This change has unfortunately made MSVC unhappy - https://build.kde.org/view/Failing/job/Frameworks/job/kfilemetadata/job/kf5-qt5%20WindowsMSVCQt5.11/lastFailedBuild/
Please note that there are very few people involved with Windows builds (despite the number of projects that make use of them in general) so people may not always have the ability to respond to every review request.
That is why the CI system monitors the state of code and can catch issues as they happen.
If there are OS specific changes, and they are added to the subscribers list, they damn should. The CI catches some errors, but not everything.
Also, this code is not covered by the unit tests on Windows, so even when the CI shows green this just means it compiles.