flathub / org.geany.Geany

https://flathub.org/apps/details/org.geany.Geany
6 stars 6 forks source link

can't execute C code geany flatpak #14

Open fastrizwaan opened 3 years ago

fastrizwaan commented 3 years ago

Here's the traditional hello world program

/* hello.c */
#include <stdio.h>
int main()
{
    printf("Hello World!\n");
    return 0;
}

compiles fine

gcc -Wall -o "hello" "hello.c" (in directory: /home/rizvan/Documents/c)
Compilation finished successfully.

Builds fine

gcc -Wall -o "hello" "hello.c" (in directory: /home/rizvan/Documents/c)
Compilation finished successfully.

Screenshot from 2020-12-09 20-54-49

Bug:

20:54:38: Cannot execute build command "xterm -c "/bin/sh /tmp/geany_run_script_LPDOV0.sh"": No such file or directory. Check the Terminal setting in Preferences

I think we should include xterm along with geany flatpak, so that C and other programs execute.

Thanks.

hcstadler commented 2 years ago

This is most likely due to /tmp not beeing accessible from within the flatpak sandbox, see https://docs.flatpak.org/en/latest/sandbox-permissions.html

I don't know geany nor flatpak well enough to make highly qualified suggestions, but in general would do one of this: 1) Make the temporary directory configurable, so I could set it to /home/user/.geany/tmp myself 2) If geany respects some environment variable like TMPDIR, maybe it could be set to some shared place that makes sense 3) If the blacklisting of /tmp is not put in stone, make that directory accessible for geany within the sandbox

In the hope that could help, HC

TiZ-HugLife commented 2 years ago

I don't think it's a thing of it being unable to access /tmp. I am pretty sure that is something we already wrestled with and fixed in this package. The problem is indeed that xterm isn't available:

❯ flatpak run --command=bash org.geany.Geany 
📦 [📦 org.geany.Geany ~]$ xterm
bash: xterm: command not found

I don't know why it wants to spawn a separate terminal instead of running the program in its integrated terminal. There is not a terminal available in the FD.O SDK runtime. However, VTE, which we do pull in (and I think was in the GNOME SDK), does provide its own terminal, /app/bin/vte-2.91. We could patch Geany to make that the default, but I think that might be a fool's errand, because something tells me the name of that binary will change over time. I think the most straightforward way to fix this is to include a shell script called xterm that serves as a wrapper around the VTE terminal.

Do any of the other maintainers object to this? This would likely fix #4 as well.

zmedico commented 1 week ago

In com.visualstudio.code they install host-spawn which enables a host shell in the integrated terminal.

fastrizwaan commented 1 week ago

here's a solution: replace xterm -e "/bin/sh %c" with vte-2.91 -- /bin/bash -c "chmod +rx %c; %c;read"

image