Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support runtime configurable paths #21484

Open
prodrigestivill opened this issue Mar 14, 2023 · 4 comments
Open

Support runtime configurable paths #21484

prodrigestivill opened this issue Mar 14, 2023 · 4 comments

Comments

@prodrigestivill
Copy link
Contributor

Description

In the radare2 snap version the installation paths changes on every build install because it is using the classic confinement and the actual installed path changes on runtime.

Currently the following environment variables are set to address this issue:

environment:
  R2_LIBR_PLUGINS: "$SNAP/usr/lib/radare2/$SNAP_VERSION"
  R2_MAGICPATH: "$SNAP/usr/share/radare2/$SNAP_VERSION/magic"
  SLEIGHHOME: "$SNAP/usr/lib/radare2/$SNAP_VERSION"

With this configuration plugins, sleigh and magic files are loaded correctly.

First issue: radare2 -H

The first issue would be that the paths changed on runtime currently are not reported back when running radare2 -H command, not sure the importance/effects of this.

Second issue: the rest of share files

The second issue are that radare2 in snap don't load any other file from /usr/share/radare2/VERSION/*, example of files not loaded are: charsets, cons, fcnsign, flag, format, hid, opcodes, syscall, www, ...

Inspired on what is observed the radare2 -H output a possible solution could be to implemented the use of R2_PREFIX env var for those paths, also allowing to remove the now unneeded R2_MAGICPATH from the snap environment.

Alternatively adding variables for each non working paths, like the one currently working for R2_MAGICPATH could also be a possible solution.

Whatever fits best for the project rest of environments where it is executed.

@trufae
Copy link
Collaborator

trufae commented Mar 14, 2023

that may help towards this :) #21486

@prodrigestivill
Copy link
Contributor Author

prodrigestivill commented Mar 14, 2023

I think it works, just as a comment, the variables R2_INCDIR and R2_LIBDIR are still reported wrong in the radare2 -H. But I don't think it will affect anything for now...

@trufae
Copy link
Collaborator

trufae commented Mar 15, 2023

Yep. im aware, incdir/libdir are not tied to prefix, its a similar issue to the problem i faced when generating the pkg config files. But those vars are not used anywhere outside r2pm. So i think that for runtime we are good to go. i'll look into testing r2pm with the snap package installed (without any local installation) and come back to you. But i think we are good to update the snap package now!

Thanks!

@prodrigestivill
Copy link
Contributor Author

prodrigestivill commented Sep 3, 2024

As a note, this will affect the new iaito-snap implementation (linked issue above).

Current iaito snap implementation defines correctly R2_PREFIX environment varible, but this doesn't fix R2_INCDIR, R2_LIBDIR and R2_BINDIR.

So my understanding is that as of now, if somebody tries to use iaito.r2pm when only having iaito snap installed, it will try to access to the paths from radare2 snap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants