[haiku-commits] haiku: hrev53132 - in src: add-ons/kernel/file_systems/packagefs/volume servers/package

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 15 May 2019 16:19:20 -0400 (EDT)

hrev53132 adds 2 changesets to branch 'master'
old head: f85e030047e96fc3ae57af2fff35e6059d71ea77
new head: ec5b988026829ed3f1afbe6322a5b444dc5c0251
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=ec5b98802682+%5Ef85e030047e9

----------------------------------------------------------------------------

f6f19105dccc: package_daemon: Actually return transaction errors instead of OK 
always.
  
  This "fixes" #10959, though now the varying potential causes of that
  will now print actual errors earlier instead of the error message
  in that ticket.

ec5b98802682: packagefs: Use more descriptive error codes on failing 
activations.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 11 insertions(+), 8 deletions(-)
.../kernel/file_systems/packagefs/volume/Volume.cpp | 17 ++++++++++-------
src/servers/package/Volume.cpp                      |  2 +-

############################################################################

Commit:      f6f19105dccc07fcf567d1b6b243ffdb54eb2058
URL:         https://git.haiku-os.org/haiku/commit/?id=f6f19105dccc
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed May 15 19:58:29 2019 UTC

Ticket:      https://dev.haiku-os.org/ticket/10959

package_daemon: Actually return transaction errors instead of OK always.

This "fixes" #10959, though now the varying potential causes of that
will now print actual errors earlier instead of the error message
in that ticket.

----------------------------------------------------------------------------

diff --git a/src/servers/package/Volume.cpp b/src/servers/package/Volume.cpp
index 700de901f3..6ec0865871 100644
--- a/src/servers/package/Volume.cpp
+++ b/src/servers/package/Volume.cpp
@@ -1373,7 +1373,7 @@ Volume::_CommitTransaction(BMessage* message,
                error = B_TRANSACTION_NO_MEMORY;
        }
 
-       _result.SetError(B_TRANSACTION_OK);
+       _result.SetError(error);
 
        // revert on error
        if (error != B_TRANSACTION_OK)

############################################################################

Revision:    hrev53132
Commit:      ec5b988026829ed3f1afbe6322a5b444dc5c0251
URL:         https://git.haiku-os.org/haiku/commit/?id=ec5b98802682
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed May 15 20:16:39 2019 UTC

packagefs: Use more descriptive error codes on failing activations.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/file_systems/packagefs/volume/Volume.cpp 
b/src/add-ons/kernel/file_systems/packagefs/volume/Volume.cpp
index b8949b450f..a94886da67 100644
--- a/src/add-ons/kernel/file_systems/packagefs/volume/Volume.cpp
+++ b/src/add-ons/kernel/file_systems/packagefs/volume/Volume.cpp
@@ -1517,7 +1517,7 @@ Volume::_ChangeActivation(ActivationChangeRequest& 
request)
                                || item->parentDirectoryID != 
fPackagesDirectory->NodeID()) {
                                ERROR("Volume::_ChangeActivation(): mismatching 
packages "
                                        "directory\n");
-                               RETURN_ERROR(B_BAD_VALUE);
+                               RETURN_ERROR(B_MISMATCHED_VALUES);
                        }
 
                        Package* package = _FindPackage(item->name);
@@ -1526,21 +1526,21 @@ Volume::_ChangeActivation(ActivationChangeRequest& 
request)
                                if (package != NULL) {
                                        ERROR("Volume::_ChangeActivation(): 
package to activate "
                                                "already activated: \"%s\"\n", 
item->name);
-                                       RETURN_ERROR(B_BAD_VALUE);
+                                       RETURN_ERROR(B_NAME_IN_USE);
                                }
                                newPackageCount++;
                        } else if (item->type == PACKAGE_FS_DEACTIVATE_PACKAGE) 
{
                                if (package == NULL) {
                                        ERROR("Volume::_ChangeActivation(): 
package to deactivate "
                                                "not found: \"%s\"\n", 
item->name);
-                                       RETURN_ERROR(B_BAD_VALUE);
+                                       RETURN_ERROR(B_NAME_NOT_FOUND);
                                }
                                oldPackageCount++;
                        } else if (item->type == PACKAGE_FS_REACTIVATE_PACKAGE) 
{
                                if (package == NULL) {
                                        ERROR("Volume::_ChangeActivation(): 
package to reactivate "
                                                "not found: \"%s\"\n", 
item->name);
-                                       RETURN_ERROR(B_BAD_VALUE);
+                                       RETURN_ERROR(B_NAME_NOT_FOUND);
                                }
                                oldPackageCount++;
                                newPackageCount++;
@@ -1548,7 +1548,9 @@ Volume::_ChangeActivation(ActivationChangeRequest& 
request)
                                RETURN_ERROR(B_BAD_VALUE);
                }
        }
-INFORM("Volume::_ChangeActivation(): %" B_PRId32 " new packages, %" B_PRId32 " 
old packages\n", newPackageCount, oldPackageCount);
+
+       INFORM("Volume::_ChangeActivation(): %" B_PRId32 " new packages, %" 
B_PRId32
+               " old packages\n", newPackageCount, oldPackageCount);
 
        // Things look good so far -- allocate reference arrays for the 
packages to
        // add and remove.
@@ -1608,7 +1610,8 @@ INFORM("Volume::_ChangeActivation(): %" B_PRId32 " new 
packages, %" B_PRId32 " o
                oldPackageReferences[oldPackageIndex++].SetTo(package);
                _RemovePackageContent(package, NULL, true);
                _RemovePackage(package);
-INFORM("package \"%s\" deactivated\n", package->FileName().Data());
+
+               INFORM("package \"%s\" deactivated\n", 
package->FileName().Data());
        }
 // TODO: Since package removal cannot fail, consider adding the new packages
 // first. The reactivation case may make that problematic, since two packages
@@ -1627,7 +1630,7 @@ INFORM("package \"%s\" deactivated\n", 
package->FileName().Data());
                        _RemovePackage(package);
                        break;
                }
-INFORM("package \"%s\" activated\n", package->FileName().Data());
+               INFORM("package \"%s\" activated\n", 
package->FileName().Data());
        }
 
        // Try to roll back the changes, if an error occurred.


Other related posts:

  • » [haiku-commits] haiku: hrev53132 - in src: add-ons/kernel/file_systems/packagefs/volume servers/package - waddlesplash