Re: Question about libcc.fs and finding path of dynamic library

Bernd Paysan <[email protected]> Tue, 10 Mar 2020 00:44:31 +0100
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <28286520.1KrjmiM6GZ@daiyu>
Am Montag, 9. März 2020, 21:14:41 CET schrieb Philip Smith:
> I have some code that needs to run as root.  I was planning to do this via
> inetd the super-server and calling the code as root like example inetd.conf
> here:
> 
> myservice stream tcp nowait root /pathtomycode/mycode.fs mycode.fs -e
> "startingword"
> 
> This configuration works until i start to use c-library stuff.
> The version of Gforth i am using is 0.7.9_20200206
> 
> If i first run the code as root from cmd line so the library stuff gets
> compiled there is no problem and the library stuff gets put in
> /root/.cache/gforth/arm/libcc-tmp path.
> Then if i try to use curl to call the code via inetd i get errors telling
> me "no such file or directory c-library mylibrary"  .
> I know the curl command is calling the code because if i remove the library
> from the code i can make this stuff work.
> My question is there some work around here to use a fixed path to my
> library?
> I did some testing using apache web server and i presume it uses www-data
> as the user but it generates the same errors so it seems to me that
> libcc.fs is trying to find some path that it cant find.
> I see the path's used in libcc.fs having something like "~/.cache......" at
> the start so i know it is done in that libcc.fs code but it seems to me
> that the "~/" should allow the root access of inetd to work and yet it does
> not!
> 
> I know this is a complex problem and i am asking a lot here but any help
> would be appreciated!

inetd probably has some jailing to prevent you to access ~/.cache or so.  
Anyways GFORTHCCPATH is the environment variable that is used as search path 
for libraries when set; and for build purpose, there's also libccdir 
(lowercase) that does the same thing.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o id: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
https://net2o.de/
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEERJ1NDqPQRwYnwBjr9y2Uk5MtoGcFAl5m1OAACgkQ9y2Uk5Mt
oGfLfhAAluSUteGjQjrcHTepE1Sj1ppUji32XwcD9zDZ+lSQmT21gDU6oaBiTG1z
b4zEUrR1C2fcW48pCO1NnAvN4kXegfdRVbiAiufPBaVwE2uxoJLzF0gymzMnCbNi
Z8B4pAfy0ge78T7RJi66uIi3KkZA+WwGF6DUM4YG5YmyaHQX1ieVjGloZOfeo2By
4nDEH5Je/abRRQPjq8ULNuBtN93o8M/hMonQWWGXE8DbuMbVzHBLLtRhKLI9mTkx
RHZh6l35kDsa67VegFOZbAzAgUwTCqYHg60vknBo/NZTnaLeHLNkv14mWsDZISqy
iVCZjrArfMjyVMg4AsTHjJtntFk/FjyoMWJRgsqtHtQuiaqqvUvLqoPhgJ2G9Bmj
r0/jvdax29qzs4MgyTR1NNqot65cCqvUqN2lQthMCpAehvjTlC/WLLBAecH1pNYv
nQejxiE4Uwo7cNdcpcaYnINoiQ7+CwI8CUO1FH+RhqvISy55sqD22PUsWxA6xjI5
tEYbwpRKr6h1ma0hTi4LBfu7gOKxyTNejbPTrNJnsnzuVzWcGYnDSsdrcqTOA0eM
m8kOFHL28+2Kvo5z0ZXdO/QhXruAhmsehVFL9LD/BkcO+BMIpb0aDo4BemeVDVd1
VRm89kCzPSt0FaA1DpCEmpN2RcQkoXzi9ipR0fL+sTwQQpA8q60=
=C3hY
-----END PGP SIGNATURE-----