Author: jim Date: Tue Feb 12 15:35:36 2019 New Revision: 1853445 URL: http://svn.apache.org/viewvc?rev=1853445&view=rev Log: Merge r1853443, r1853444 from trunk:
This is the wrong place to do this, because we are unilaterally overruling CWD. Revert Only update PATH if /usr/local/bin is missing for macOS Reviewed by: jim Modified: openoffice/branches/AOO42X/ (props changed) openoffice/branches/AOO42X/main/odk/source/unoapploader/unx/unoapploader.c openoffice/branches/AOO42X/main/sal/osl/unx/nlsupport.c Propchange: openoffice/branches/AOO42X/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Feb 12 15:35:36 2019 @@ -9,4 +9,4 @@ /openoffice/branches/ia2:1417739-1541842 /openoffice/branches/ooxml-osba:1546391,1546395,1546574,1546934,1547030,1547392,1551920,1551954,1551958,1552283 /openoffice/branches/rejuvenate01:1480411,1534063,1534098,1536312,1549902,1560617 -/openoffice/trunk:1851110-1851111,1851115,1851118,1851121,1851206,1851214-1851215,1851443,1851449,1851464,1851575,1851634,1851637,1851639,1851715,1851813,1851987,1852008,1852010,1852029,1852046,1852174,1852187,1852190,1852430,1852438,1852623-1852624,1853175,1853319 +/openoffice/trunk:1851110-1851111,1851115,1851118,1851121,1851206,1851214-1851215,1851443,1851449,1851464,1851575,1851634,1851637,1851639,1851715,1851813,1851987,1852008,1852010,1852029,1852046,1852174,1852187,1852190,1852430,1852438,1852623-1852624,1853175,1853319,1853443-1853444 Modified: openoffice/branches/AOO42X/main/odk/source/unoapploader/unx/unoapploader.c URL: http://svn.apache.org/viewvc/openoffice/branches/AOO42X/main/odk/source/unoapploader/unx/unoapploader.c?rev=1853445&r1=1853444&r2=1853445&view=diff ============================================================================== --- openoffice/branches/AOO42X/main/odk/source/unoapploader/unx/unoapploader.c (original) +++ openoffice/branches/AOO42X/main/odk/source/unoapploader/unx/unoapploader.c Tue Feb 12 15:35:36 2019 @@ -209,17 +209,19 @@ int main( int argc, char *argv[] ) #ifdef MACOSX /* https://bz.apache.org/ooo/show_bug.cgi?id=127965 */ value = getenv( "PATH" ); - size = strlen( "PATH" ) + strlen( "=/usr/local/bin" ) + 1; - if ( value != NULL ) - size += strlen( PATHSEPARATOR ) + strlen( value ); - envstr = (char*) malloc( size ); - strcpy( envstr, "PATH=" ); - if ( value != NULL ) { - strcat( envstr, value); - strcat( envstr, PATHSEPARATOR); + if (!strstr ( value, "/usr/local/bin" )) { + size = strlen( "PATH" ) + strlen( "=/usr/local/bin" ) + 1; + if ( value != NULL ) + size += strlen( PATHSEPARATOR ) + strlen( value ); + envstr = (char*) malloc( size ); + strcpy( envstr, "PATH=" ); + if ( value != NULL ) { + strcat( envstr, value); + strcat( envstr, PATHSEPARATOR); + } + strcat( envstr, "/usr/local/bin" ); /* We are adding at the end */ + putenv( envstr ); } - strcat( envstr, "/usr/local/bin" ); /* We are adding at the end */ - putenv( envstr ); /* https://bz.apache.org/ooo/show_bug.cgi?id=127966 */ value = getenv ( "HOME" ); Modified: openoffice/branches/AOO42X/main/sal/osl/unx/nlsupport.c URL: http://svn.apache.org/viewvc/openoffice/branches/AOO42X/main/sal/osl/unx/nlsupport.c?rev=1853445&r1=1853444&r2=1853445&view=diff ============================================================================== --- openoffice/branches/AOO42X/main/sal/osl/unx/nlsupport.c (original) +++ openoffice/branches/AOO42X/main/sal/osl/unx/nlsupport.c Tue Feb 12 15:35:36 2019 @@ -876,32 +876,23 @@ void _imp_getProcessLocale( rtl_Locale * * This is a hack. We know that we are setting some envvars here * and due to https://bz.apache.org/ooo/show_bug.cgi?id=127965 * we need to update PATH on macOS. Doing it here ensures - * that it's done but it's not the right location to be doing + * that it's done but it's not the perfect location to be doing * this. - * - * Also address https://bz.apache.org/ooo/show_bug.cgi?id=127966 - * here as well :/ */ opath = getenv ( "PATH" ); - slen = strlen( "/usr/local/bin" ) + 1; - if ( opath != NULL ) - slen += strlen( ":" ) + strlen( opath ); - npath = malloc( slen ); - *npath = '\0'; - if ( opath != NULL ) { - strcat( npath, opath ); - strcat( npath, ":" ); - } - strcat( npath, "/usr/local/bin" ); /* We are adding at the end */ - setenv("PATH", npath, 1 ); - free(npath); - -/* https://bz.apache.org/ooo/show_bug.cgi?id=127966 */ - opath = getenv ( "HOME" ); - if ( opath && *opath ) { - chdir ( opath ); - } else { - chdir ( "/tmp" ); + if (!strstr ( opath, "/usr/local/bin" )) { + slen = strlen( "/usr/local/bin" ) + 1; + if ( opath != NULL ) + slen += strlen( ":" ) + strlen( opath ); + npath = malloc( slen ); + *npath = '\0'; + if ( opath != NULL ) { + strcat( npath, opath ); + strcat( npath, ":" ); + } + strcat( npath, "/usr/local/bin" ); /* We are adding at the end */ + setenv("PATH", npath, 1 ); + free(npath); } #ifdef DEBUG