First a link to the tree before I forget:
GitHub - awsdert/gasp at 3b829258bbaa716314b15b023ed0367e5fcf6ed1
These are the scenarios that I'm programming around (using > to represent launch action, # to represent environment variables passed on):
Code:
user > gasp
user > gasp > pkexec > gasp -D HAVE_ROOT_PERM #
user > gasp -D USE_GEDE > pkexec > gasp -D HAVE_ROOT_PERM -D USE_GEDE # > gede --args gasp -D HAVE_ROOT_PERM #
The last scenario currently fails with this output (paths where edited):
Code:
./gasp-d.elf -D USE_GEDE
.../gasp-d.elf -D USE_GEDE -D HAS_ROOT_PERM -D PWD=".../gasp" -D HOME="~" -D DISPLAY=":0" -D XDG_CURRENT_DESKTOP="X-Cinnamon" -D GDMSESSION="cinnamon"
gasp.c:434:main() 0x0000008B
External Msg 'Unknown error 139'
Internal Msg 'Test failed'
make: *** [makefile:134: test] Error 1
Compilation failed.
The only function I currently find suspect is this one:
Code:
int launch_test_gasp(
nodes_t *ARGS, space_t *CMDL, char const *defines
)
{
int ret = 0;
char const *launch, *gede = "USE_GEDE",
*PWD = getenv("PWD"), *CWD = getenv("CWD");
char *cmdl, *key, *val;
node_t i;
size_t need;
kvpair_t *kvpair, *kvpairs;
if ( !g_launch_dbg )
return EINVAL;
launch = "gasp-d.elf";
if ( !PWD ) PWD = CWD;
need = BUFSIZ;
need += strlen(launch) + 1; /* For '\0' */
need += strlen(PWD) + 1; /* For '\0' */
need += strlen(gede) + 5; /* For " -D " '\0' */
kvpairs = ARGS->space.block;
for ( i = 0; i < ARGS->count; ++i )
{
kvpair = kvpairs + i;
key = kvpair->key.block;
val = kvpair->val.block;
need += strlen( key ) + strlen( val ) + 3;
}
if ( (ret = more_space( CMDL, need )) != 0 )
return ret;
cmdl = CMDL->block;
sprintf( cmdl, "gede --args %s/%s %s", PWD, launch, defines );
for ( i = 0; i < ARGS->count; ++i )
{
kvpair = kvpairs + i;
key = kvpair->key.block;
val = kvpair->val.block;
if ( key[0] == '-' && key[1] == 'D' && strstr( cmdl, val ) )
continue;
if ( val && *val )
sprintf( strchr( cmdl, '\0'), " %s %s", key, val );
else
sprintf( strchr( cmdl, '\0'), " %s", key );
}
/* Prevent infinite loop */
key = strstr( cmdl, " -D USE_GEDE" );
for ( i = 0; i < 12; ++i ) key[i] = ' ';
fprintf( stderr, "%s\n", cmdl );
return system( cmdl );
}
I need to go to shops before they close so I'll try any suggestions when I get back