olivercox
New Coder
Hi there! Thanks in advance for the help!
I'm encountering an issue in which a shell launched via my C IDE (Gnome Builder) cannot access particular files, leading to issues because it cannot see an executable I need. See a previous post (unsolved) on StackOverflow: How do I launch SBCL (or arbitrary commands) using popen?
Here's the deal:
1. I wish to build a GUI in Gnome Builder, and use it to launch various actions in the backend. The backend is written in Lisp, and for testing purposes I wish to launch the Lisp interpreter (SBCL) with the desired program.
2. When I do so, Gnome Builder throws a "command not found" error for sbcl.
3. If I change the Builder code instead to launch sh, and if I navigate to /usr/bin/ (where sbcl is found) it is not there, along with several other files, e.g. su, vi, etc.
4. sh in the Builder environment appears to have access to my main system (not a virtual machine), because it can see my home directory.
Any ideas?
See system information and code below:
My code:
Sample output of "ls" when run from a normal terminal (see sbcl (sbcl-2 is a link I created as a test)):
And from the shell when run by C in Gnome Builder (OUTPUT[] is an artifact of my program):
System information:
I'm encountering an issue in which a shell launched via my C IDE (Gnome Builder) cannot access particular files, leading to issues because it cannot see an executable I need. See a previous post (unsolved) on StackOverflow: How do I launch SBCL (or arbitrary commands) using popen?
Here's the deal:
1. I wish to build a GUI in Gnome Builder, and use it to launch various actions in the backend. The backend is written in Lisp, and for testing purposes I wish to launch the Lisp interpreter (SBCL) with the desired program.
2. When I do so, Gnome Builder throws a "command not found" error for sbcl.
3. If I change the Builder code instead to launch sh, and if I navigate to /usr/bin/ (where sbcl is found) it is not there, along with several other files, e.g. su, vi, etc.
4. sh in the Builder environment appears to have access to my main system (not a virtual machine), because it can see my home directory.
Any ideas?
See system information and code below:
My code:
Code:
int outputter(void){
FILE *output;
char buffer[BUFFER];
output = popen("sbcl", "r");
if (output == NULL) {
fputs("POPEN: Failed.\n", stderr);
}
else {
int count = 0;
while(fgets(buffer, BUFFER-1, output) != NULL) {
printf("OUTPUT[%d]: %s", count, buffer);
count ++;
}
}
pclose(output);
return 0;
}
Sample output of "ls" when run from a normal terminal (see sbcl (sbcl-2 is a link I created as a test)):
rz
samba-regedit
sancov
sane-find-scanner
sanstats
satyr
sb
sbcl
sbcl-2
scalar
scanimage
sccmap
And from the shell when run by C in Gnome Builder (OUTPUT[] is an artifact of my program):
OUTPUT[837]: run-with-aspell
OUTPUT[838]: saslauthd
OUTPUT[839]: sasldblistusers2
OUTPUT[840]: saslpasswd2
OUTPUT[841]: scalar
OUTPUT[842]: sclient
OUTPUT[843]: scmp_sys_resolver
OUTPUT[844]: scp
OUTPUT[845]: script
OUTPUT[846]: scriptlive
OUTPUT[847]: scriptreplay
OUTPUT[848]: sdiff
OUTPUT[849]: sdl2-config
OUTPUT[850]: secret-tool
OUTPUT[851]: sed
OUTPUT[852]: sefcontext_compile
OUTPUT[853]: selabel_digest
OUTPUT[854]: selabel_get_digests_all_partial_matches
OUTPUT[855]: selabel_lookup
OUTPUT[856]: selabel_lookup_best_match
OUTPUT[857]: selabel_partial_match
OUTPUT[858]: selinux_check_access
OUTPUT[859]: selinux_check_securetty_context
OUTPUT[860]: selinuxenabled
OUTPUT[861]: selinuxexeccon
OUTPUT[862]: sepdebugcrcfix
OUTPUT[863]: sepol_check_access
OUTPUT[864]: sepol_compute_av
OUTPUT[865]: sepol_compute_member
OUTPUT[866]: sepol_compute_relabel
OUTPUT[867]: sepol_validate_transition
OUTPUT[868]: seq
System information:
- OS: Fedora 38
- Language: C
- IDE: Gnome Builder
- sh: GNU bash, version 5.2.15 release (x86_64-redhat-linux-gnu)