Avoid the goto using local variables.
Use fastInsert instead of insert.
Fill the ACL of the linked destination.
Details
- Reviewers
dfaure - Group Reviewers
Frameworks - Commits
- R241:6b452ae9892d: Use non deprecated fastInsert in file.cpp (first of many to come)
The tests pass.
Dolphin works with broken symbolic links.
Diff Detail
- Repository
- R241 KIO
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Yes I guess broken symlinks can have acl informations themselves too, so I don't mind the acl code being called now and not before.
src/ioslaves/file/file.cpp | ||
---|---|---|
841 | Call it isBrokenSymlink, it's only set to true for *broken* symlinks. |
src/ioslaves/file/file.cpp | ||
---|---|---|
882–883 | BTW the point is that we follow the link (by filling "buff" with this QT_STAT call), but then we also check that call for errors: if it returned -1, then the link is broken. |
src/ioslaves/file/file.cpp | ||
---|---|---|
867 | This is broken (although not new). buff.st_size is the size of the target name without null byte. |
Added a comment: // readlink doesn't append a null byte to linkTargetBuffer.data()
Using target path to read ACL in a non broken symbolic link.
Do not fill remaining data in case of broken link, doesn't affect dolphin.
src/ioslaves/file/file.cpp | ||
---|---|---|
867 | According to the man page (2+3), readlink() does not append a null byte to buf. It will (silently) truncate the contents (to a length of bufsiz characters), in case the buffer is too small to hold all of the contents. |
src/ioslaves/file/file.cpp | ||
---|---|---|
867 | The comment does not solve the issue, neither does it help to clarify anything ... buffersize has to be larger than buff.st_size, otherwise there is no possibility to diffentiate the 'fits exactly' and 'was truncated' cases, both will return n == buffersize. the correct fix is to use: // Add one to the size, to be able to detect truncation - // in case n == bufferSize, truncation *may* have occured size_t bufferSize = qBound(lowerLimit, buff.st_size + 1, 1024); |
Incorporated Stefan code.
Fill again the extra data like User/Group.
I don't see any change and I don't want to break anything more.
src/ioslaves/file/file.cpp | ||
---|---|---|
886 | isn't this the same as linkTargetBuffer? |
src/ioslaves/file/file.cpp | ||
---|---|---|
867 | Given that this fix is completely unrelated to this commit, it should rather be separated into a different commit... | |
886 | Yes, and in fact linkTargetBuffer is more correct. toLocal8Bit() is incorrect, QFile::encodeName/decodeName must be used for QByteArray<->QString conversions for filenames. |
Fixed targetPath of links.
Question: If there any chance that
st_birthtime
and
__st_birthtime
are both present in the same OS? If affirmative, the entry of __st_birthtime sould be filled with replace().
The comments indicate that this isn't supposed to happen, but just to make sure, you can use #elif on line 941/942.