[haiku-commits] haiku: hrev53399 - src/kits/app

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 24 Aug 2019 12:28:48 -0400 (EDT)

hrev53399 adds 2 changesets to branch 'master'
old head: 2d181d97e87c1e21e5b3c45fb8e69c4a951e3783
new head: 4eaa1f35e5e05b8f3b17cceaf32db6b68f85c28f
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=4eaa1f35e5e0+%5E2d181d97e87c

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

6faf979da7c9: BRoster: Fix infinite loop when trying to launch app with missing 
libraries.
  
  Fixes #14986.
  
  Change-Id: I727fde0c475f0684567a46be5af616cad56a9b4c
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1738
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

4eaa1f35e5e0: BRoster: preserve symlink as "app" if given one
  
  Symlink name or attributes may be relevant to the launched app, so it's
  important that we pass the unresolved symlink as argv[0] when running
  it.
  
  Change-Id: Ie1d73bc4e9d5c3d0476f205ce635aafd9203e553
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1739
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

1 file changed, 12 insertions(+), 3 deletions(-)
src/kits/app/Roster.cpp | 15 ++++++++++++---

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

Commit:      6faf979da7c9f74b2be1ee68016a5643fd6eb3b6
URL:         https://git.haiku-os.org/haiku/commit/?id=6faf979da7c9
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 24 12:42:17 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Aug 24 16:28:45 2019 UTC

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

BRoster: Fix infinite loop when trying to launch app with missing libraries.

Fixes #14986.

Change-Id: I727fde0c475f0684567a46be5af616cad56a9b4c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1738
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/kits/app/Roster.cpp b/src/kits/app/Roster.cpp
index 1a9b62cc63..3935057ee8 100644
--- a/src/kits/app/Roster.cpp
+++ b/src/kits/app/Roster.cpp
@@ -1872,6 +1872,7 @@ BRoster::_LaunchApp(const char* mimeType, const 
entry_ref* ref,
        thread_id appThread = -1;
        port_id appPort = -1;
        uint32 appToken = 0;
+       entry_ref hintRef;
 
        while (true) {
                // find the app
@@ -1881,6 +1882,7 @@ BRoster::_LaunchApp(const char* mimeType, const 
entry_ref* ref,
                        &appFlags, &wasDocument);
                DBG(OUT("  find app: %s (%" B_PRIx32 ") %s \n", 
strerror(error), error,
                        signature));
+
                if (error != B_OK)
                        return error;
 
@@ -1956,15 +1958,18 @@ BRoster::_LaunchApp(const char* mimeType, const 
entry_ref* ref,
                                                _RemovePreRegApp(appToken);
 
                                        if (!wasDocument) {
+                                               // Did we already try this?
+                                               if (appRef == hintRef)
+                                                       break;
+
                                                // Remove app hint if it's this 
one
                                                BMimeType appType(signature);
-                                               entry_ref hintRef;
 
                                                if (appType.InitCheck() == B_OK
                                                        && 
appType.GetAppHint(&hintRef) == B_OK
                                                        && appRef == hintRef) {
                                                        
appType.SetAppHint(NULL);
-                                                       // try again
+                                                       // try again with the 
app hint removed
                                                        continue;
                                                }
                                        }

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

Revision:    hrev53399
Commit:      4eaa1f35e5e05b8f3b17cceaf32db6b68f85c28f
URL:         https://git.haiku-os.org/haiku/commit/?id=4eaa1f35e5e0
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sat Aug 24 13:52:17 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Aug 24 16:28:45 2019 UTC

BRoster: preserve symlink as "app" if given one

Symlink name or attributes may be relevant to the launched app, so it's
important that we pass the unresolved symlink as argv[0] when running
it.

Change-Id: Ie1d73bc4e9d5c3d0476f205ce635aafd9203e553
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1739
Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

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

diff --git a/src/kits/app/Roster.cpp b/src/kits/app/Roster.cpp
index 3935057ee8..1c1d2381cd 100644
--- a/src/kits/app/Roster.cpp
+++ b/src/kits/app/Roster.cpp
@@ -2194,6 +2194,8 @@ BRoster::_TranslateRef(entry_ref* ref, BMimeType* appMeta,
        if (ref == NULL || appMeta == NULL || appRef == NULL || appFile == NULL)
                return B_BAD_VALUE;
 
+       entry_ref originalRef = *ref;
+
        // resolve ref, if necessary
        BEntry entry;
        status_t error = entry.SetTo(ref, false);
@@ -2254,7 +2256,9 @@ BRoster::_TranslateRef(entry_ref* ref, BMimeType* appMeta,
                // we're done.
                char preferredApp[B_MIME_TYPE_LENGTH];
                if (!isDocument || appFileInfo.GetPreferredApp(preferredApp) != 
B_OK) {
-                       *appRef = *ref;
+                       // If we were given a symlink, point appRef to it in 
case its name
+                       // or attributes are relevant.
+                       *appRef = originalRef;
                        if (_wasDocument != NULL)
                                *_wasDocument = isDocument;
 


Other related posts:

  • » [haiku-commits] haiku: hrev53399 - src/kits/app - waddlesplash