[haiku-commits] Change in haiku[master]: Installer: fix an issue where file attributes were not copied

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 7 May 2020 20:30:35 +0000

From Niels Sascha Reedijk <niels.reedijk@xxxxxxxxx>:

Niels Sascha Reedijk has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2600 ;)


Change subject: Installer: fix an issue where file attributes were not copied
......................................................................

Installer: fix an issue where file attributes were not copied

The issue was introduced when the original CopyFile() and CopyFolder() methods
were integrated into a single recursive Copy() method in
bf551d3889bfdce1e2250df307d505d88fe6c4e1

The installer originally followed the principle that attributes are not copied
for target directories that already exist. Unfortunately the new logic to
filter out that case disables attribute copying in recursive calls of this
method, thus breaking things like bookmarks and tracker templates.

Fixes #15913
---
M src/apps/installer/CopyEngine.cpp
1 file changed, 8 insertions(+), 3 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/00/2600/1

diff --git a/src/apps/installer/CopyEngine.cpp 
b/src/apps/installer/CopyEngine.cpp
index b0b1286..225bd90 100644
--- a/src/apps/installer/CopyEngine.cpp
+++ b/src/apps/installer/CopyEngine.cpp
@@ -329,6 +329,11 @@
        if (cancelSemaphore >= 0)
                lock.Unlock();

+       bool copyAttributesToTarget = copyAttributes;
+               // attributes of the current source to the destination will be 
copied
+               // when copyAttributes is set to true, but there may be 
exceptions, so
+               // allow the recursively used copyAttribute parameter to be 
overridden
+               // for the current target.
        if (S_ISDIR(sourceInfo.st_mode)) {
                BDirectory sourceDirectory(&source);
                ret = sourceDirectory.InitCheck();
@@ -345,7 +350,7 @@
                                        // Do not overwrite attributes on 
folders that exist.
                                        // This should work better when the 
install target
                                        // already contains a Haiku 
installation.
-                                       copyAttributes = false;
+                                       copyAttributesToTarget = false;
                                }
                        } else {
                                ret = destination.Remove();
@@ -431,8 +436,8 @@
                }
        }

-       if (copyAttributes) {
-               // copy attributes
+       if (copyAttributesToTarget) {
+               // copy attributes to the current target
                BNode sourceNode(&source);
                BNode targetNode(&destination);
                char attrName[B_ATTR_NAME_LENGTH];

--
To view, visit https://review.haiku-os.org/c/haiku/+/2600
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I0dfe5ce30fdc78cfd4e3695b4b4e8c23b4848100
Gerrit-Change-Number: 2600
Gerrit-PatchSet: 1
Gerrit-Owner: Niels Sascha Reedijk <niels.reedijk@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: Installer: fix an issue where file attributes were not copied - Gerrit