Don't create new symlinks when copying symlinks - copy the file's contents - like /usr/bin/cp
AbandonedPublic

Authored by shlomif on Oct 13 2017, 9:33 AM.

Details

Reviewers
dfaure
Summary

This patch copies the symlinked file's contents upon a copy - like /usr/bin/cp instead of creating a new symlink. This is an attempt to fix https://bugs.kde.org/show_bug.cgi?id=315482 and https://bugs.kde.org/show_bug.cgi?id=335808 which were reported in gwenview and was done per consensus in an IRC discussion on #kde-devel on freenode. Also see https://git.reviewboard.kde.org/r/125227/ . Please review it SOON before Phabricator is replaced by something else.

Diff Detail

Repository
R241 KIO
Lint
Lint Skipped
Unit
Unit Tests Skipped
shlomif created this revision.Oct 13 2017, 9:33 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptOct 13 2017, 9:33 AM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript

You don't have to worry about Phabricator going away, we were on Reviewboard for quite a long time before we started to move away from it.

Unfortunately, this two year old patch does not apply for me anymore to the current git master (while it did apply to v5.15.0, it would not compile then).

In addition, I'm not convinced this should be changed at the Frameworks level. Developers might rely on the current behaviour, so the patch should probably rather clarify the API docs from cp to cp -a. According to @dfaure, this is on purpose. If your IRC logs say otherwise, feel free to post them here for reference.

To give a practical example: Let's assume in Dolphin a user copies a folder to another location on the same partition, which he later plans to restore after trying out some things in the original folder. He would rightly expect to get back the original state, including all symlinks. With your patch (please correct me if I misunderstood) this would break.

Therefore, I would encourage you (in addition to the API docs modification) to provide patches, or at least open bugzilla issues where still missing, against applications where a deep copy would be the appropriate behaviour indeed (e.g. Gwenview).

dfaure requested changes to this revision.Dec 2 2017, 4:08 PM

Yes, emulating cp -a is on purpose.

A flag for a "deep copy" might be useful, but not changing the default behaviour.

And I definitely hope this patch breaks jobtest ;-)

(otherwise it would mean jobtest is missing testcases)
This revision now requires changes to proceed.Dec 2 2017, 4:08 PM

@shlomif any plans on redoing this another way? Otherwise can you close the review request, to clean up dashboards?

Restricted Application edited subscribers, added: kde-frameworks-devel; removed: Frameworks. · View Herald TranscriptApr 12 2020, 12:20 PM
shlomif abandoned this revision.Apr 12 2020, 7:00 PM

Closing then. I don't have any immediate plans for reworking this patch.