FreeBSD bsd.local 12.0-CURRENT Geany 1.32, de_DE.UTF-8
I am trying to run `context` inside the make configuration `context "%d/%f"`
`context -v "/usr/home/martin/Dokumente/hallo.tex" (im Verzeichnis: /usr/home/martin/Dokumente) /bin/sh: context: not found ` the same command works well in the regular terminal
I cannot figure out where geany gets the env/$PATH from, or actually fails to get it. What do I need to configure where to have geany evaluate the environment?
I found an old thread from 2014 having the same problem and it remained unsolved (leaving hacks aside)
[](https://www.linuxquestions.org/questions/linux-general-1/%24path-different-f...)
What I have tried:
Running env as a make command does show a $PATH that misses the relevant path to the needed binary. ` PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/home/martin/bin `
` $ which context /usr/home/martin/context/tex/texmf-freebsd-amd64/bin/context ` PATH is set in .bashrc: ` export PATH=$PATH:/usr/home/martin/context/tex/texmf-freebsd-amd64/bin export MY_BASH=bashrc-greetings ` .profile is not read at all, a similar MY_PROFILE never shows with env.
Using the inbuilt terminal of geany, I get the same env as from the regular terminal, ie, $PATH is set
My settings for terminal in VTE shell are, exactly what `which bash` gives `/usr/local/bin/bash`
I tried changing settings/tools/terminal from: `xterm -e "/bin/sh %c"` to: `xterm -e "/usr/local/bin/bash %c"`
That has no effect either. ` /bin/sh: context: not found` remains
Whatever `/bin/sh` is pointing to on your system is probably not Bash and not reading your `.bashrc`. The `/bin/sh` [is hardcoded](https://github.com/geany/geany/blob/1.33.0/src/build.c#L728). If you want a comparable test in the builtin VTE terminal, change `Preferences->Terminal->Shell` to `/bin/sh` and that would be equivalent to what's going on in the build command.
You could probably set your build command to `bash -c 'context "%d/%f"'` or else just use the full path to `context` like `/usr/home/martin/context/tex/texmf-freebsd-amd64/bin/context "%d/%f"`. Alternatively, you could figure out what shell is `/bin/sh` and use its mechanism for updating `PATH` as you do with Bash.
Or, if you are starting Geany from a menu it might not be running in a shell, so your .bashrc is not being read.
@codebrainz thanks for the thoughts. The Preferences->Terminal->Shell was of course `/bin/sh` before. Changing it to bash a futile attempt...
The idea of providing the full path fails. `context` itself is a wrapper and then further calls are made. But actually I get: `bash: context: Kommando nicht gefunden.` It can't find bash. Back to square one. The $PATH to bash is added in `.bashrc`. It is also added in `.profile`, but, as noticed before, that is not evaluated.
From `man sh` I see that `/etc/profile` or the `~/.profile` are used... I tried adding a PATH into both of them .... the path is never set. sh is only declared as "default" shell for FreeBSD
`PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$HOME/bin:/usr/home/martin/context/tex/texmf-freebsd-amd64/bin; export PATH `
Could the hardcoding of the /bin/sh call cause part of the problems?
Which brings me to @elextr comment. Yes, very valid thought. But wouldn't some environment for those programs exist? And, unless hardcoding prevents it, that should be configured somewhere.
My question then: how does geany pick up the environment of the current user?
Reading around on the topic, there seem to be different approaches on how a program is called from the GUI. A thread about the atom editor, albeit referring to OS X, goes through similar thoughts. No real result is reached. I have had similar experiences on Mac in the past with occasional Apps
`https://github.com/electron/electron/issues/550%60
I tried something similar with gvim, starting it from the GUI it fails to get the environment too. Starting vim (not gvim) from the GUI sometimes works, sometimes doesn't. Starting either via terminal, there is no problem as with geany. I used this to find out what env I have in vim/gvim:
` :sh env `
In any case, whatever happens in the background between geany (gvim) and the Lumina Desktop is not as desired.
My question then: how does geany pick up the environment of the current user?
Same as every Unix program, it is either inherited or specified by its parent.
If Geany (or any program) is started from the command line its parent is bash, which read the .bashrc file and added things you defined there to the environment it passes to programs it starts.
But if Geany (or any program) is started from the menu, it is inheriting the environment of the desktop, which got it from its parent, which varies somewhat but is probably your graphical login manager, which is started by the system startup.
Nowhere in that sequence is there a bash running as your user (so it knows which .bashrc to read).
You need to configure the desktop to run geany as a bash command ie something like `/bin/bash -c geany`.
Nowhere in that sequence is there a bash running as your user (so it knows which .bashrc to read).
The build commands run your command in whatever shell `/bin/sh` links to as your user, no?
Closed #1887.
Reopened #1887.
@codebrainz yes, but bash started as `sh` doesn't read `.bashrc` or `.profile` (GTFM).
This sounds like not a Geany issue.
ok. **Solved**. Kind of. Thanks to you guys!
What happens is this: when I log into the Lumina desktop, the `$PATH` is set in `~/.xprofile` Adding the right PATH in there solves the issue for geany. It now is a proper environment set. Now I can get to setting up my `context` working environment. Realizing context is not supported much as yet, I am curious to see how far I get.
The question that still puzzles me is why `.profile` is completely ignored. My understanding is, it should be executed once at first login... But that is something I will take to the TrueOS forum!
Closed #1887.
github-comments@lists.geany.org