<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div data-zbluepencil-ignore="true" style="" class="zmail_extra">I agree with that, but it's been an issue for well over 3 years at this point and I've experienced it on multiple distros.<br><br>The worst thing we can do for the typical end user is to infinitely spawn processes endlessly...<br>It's painful -- especially when winebrowser keeps becoming the default (not just links, for PDFs, etc) for whatever reason.<br><br>- Josh 🐸<br><br><div id="Zm-_Id_-Sgn1">---- On Thu, 20 Feb 2020 05:03:35 +0000 <b>Zebediah Figura <<a target="_blank" href="mailto:z.figura12@gmail.com">z.figura12@gmail.com</a>></b> wrote ----<br></div><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); padding-left: 6px; margin: 0px 0px 0px 5px;"><div>On 2/7/20 11:54 AM, Joshua Ashton wrote: <br>> If the user's default browser application is winebrowser then we go <br>> into a a state where winebrowser calls winebrowser which calls <br>> winebrowser... forever. <br>> <br>> Sometimes winebrowser is registered as a potential browser and even <br>> as the default when Wine is installed which makes this a genuine <br>> issue. <br> <br>Where are you getting this? I don't see any code in Wine to set <br>winebrowser as the default browser for winebrowser itself, or indeed to <br>set any browser. <br> <br>I wouldn't expect setting winebrowser as winebrowser's default browser <br>to work, and I'd be personally inclined to say that whoever does that <br>gets to keep the pieces. If distributions are doing this for some <br>reason, well, they shouldn't do that. <br> <br>> <br>> Signed-off-by: Joshua Ashton <<a target="_blank" href="mailto:joshua@froggi.es">joshua@froggi.es</a>> <br>> --- <br>>  programs/winebrowser/main.c | 40 +++++++++++++++++++++++++++---------- <br>>  1 file changed, 29 insertions(+), 11 deletions(-) <br>> <br>> diff --git a/programs/winebrowser/main.c b/programs/winebrowser/main.c <br>> index 9cd6812d03..1294ebf54f 100644 <br>> --- a/programs/winebrowser/main.c <br>> +++ b/programs/winebrowser/main.c <br>> @@ -69,31 +69,49 @@ static char *strdup_unixcp( const WCHAR *str ) <br>>      return ret; <br>>  } <br>> <br>> +/* forbidden apps that we will test for and never launch <br>> + * because they could cause us to create new processes indefinitely */ <br>> +static const WCHAR forbidden_apps[] = <br>> +    {'w','i','n','e','b','r','o','w','s','e','r',0,0}; <br>> + <br>>  /* try to launch a unix app from a comma separated string of app names */ <br>>  static int launch_app( const WCHAR *candidates, const WCHAR *argv1 ) <br>>  { <br>>      char *cmdline; <br>>      int i, count; <br>>      char **argv_new; <br>> +    const WCHAR* forbidden_app = forbidden_apps; <br>> <br>>      if (!(cmdline = strdup_unixcp( argv1 ))) return 1; <br>> <br>>      while (*candidates) <br>>      { <br>> -        WCHAR **args = CommandLineToArgvW( candidates, &count ); <br>> +        /* test for forbidden apps */ <br>> +        BOOL valid_candidate = TRUE; <br>> +        while (*forbidden_app) { <br>> +            if (strstrW(candidates, forbidden_app)) <br>> +                valid_candidate = FALSE; <br>> + <br>> +            forbidden_app += strlenW( forbidden_app ) + 1;  /* grab the next app */ <br>> +        } <br>> <br>> -        if (!(argv_new = HeapAlloc( GetProcessHeap(), 0, (count + 2) * sizeof(*argv_new) ))) break; <br>> -        for (i = 0; i < count; i++) argv_new[i] = strdup_unixcp( args[i] ); <br>> -        argv_new[count] = cmdline; <br>> -        argv_new[count + 1] = NULL; <br>> +        if (valid_candidate) <br>> +        { <br>> +            WCHAR **args = CommandLineToArgvW( candidates, &count ); <br>> + <br>> +            if (!(argv_new = HeapAlloc( GetProcessHeap(), 0, (count + 2) * sizeof(*argv_new) ))) break; <br>> +            for (i = 0; i < count; i++) argv_new[i] = strdup_unixcp( args[i] ); <br>> +            argv_new[count] = cmdline; <br>> +            argv_new[count + 1] = NULL; <br>> <br>> -        TRACE( "Trying" ); <br>> -        for (i = 0; i <= count; i++) TRACE( " %s", wine_dbgstr_a( argv_new[i] )); <br>> -        TRACE( "\n" ); <br>> +            TRACE( "Trying" ); <br>> +            for (i = 0; i <= count; i++) TRACE( " %s", wine_dbgstr_a( argv_new[i] )); <br>> +            TRACE( "\n" ); <br>> <br>> -        _spawnvp( _P_OVERLAY, argv_new[0], (const char **)argv_new );  /* only returns on error */ <br>> -        for (i = 0; i < count; i++) HeapFree( GetProcessHeap(), 0, argv_new[i] ); <br>> -        HeapFree( GetProcessHeap(), 0, argv_new ); <br>> +            _spawnvp( _P_OVERLAY, argv_new[0], (const char **)argv_new );  /* only returns on error */ <br>> +            for (i = 0; i < count; i++) HeapFree( GetProcessHeap(), 0, argv_new[i] ); <br>> +            HeapFree( GetProcessHeap(), 0, argv_new ); <br>> +        } <br>>          candidates += strlenW( candidates ) + 1;  /* grab the next app */ <br>>      } <br>>      WINE_ERR( "could not find a suitable app to open %s\n", debugstr_w( argv1 )); <br>> <br>> -- <br>> 2.25.0 <br>> <br> <br></div></blockquote></div><div><br></div></div><br></body></html>