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

Clearly describe that the package is writing a binary to a temporary file in README #4

Closed
Helyk opened this issue Sep 6, 2021 · 8 comments

Comments

@Helyk
Copy link

Helyk commented Sep 6, 2021

Hello. I find the current contents of README.md somewhat misleading, in the following way.

It states:

Small library that executes code from the memory.

This creates an impression that the code (or actually binary) is being executed directly from the memory. It may be due to a specific problem that I was trying to solve when I found memexec that I made such an assumption, but I've seen some other people around trying to find a way to run an executable without writing to the filesystem, so it may be beneficial to clarify that, in fact, the executable is being written to a temporary file.

For instance, it may be written like this:

A small golang package that executes a binary file stored in memory by writing it to a temporary file, running and subsequently deleting it.

I should note that, despite not doing exactly the trick that I was searching for, this package demonstrates an implementation of a useful workaround, and I think it should stay published, but with a more accurate description.

@amenzhinsky
Copy link
Owner

Actually it's not misleading, the package does execute code from the memory, the way it does it not that important and can change in the future.

I've just pushed changes to linux that uses memfd instead of temp files on other platforms.

https://github.com/amenzhinsky/go-memexec/blob/master/memexec_linux.go

@Helyk
Copy link
Author

Helyk commented Sep 6, 2021

I've just pushed changes to linux that uses memfd instead of temp files on other platforms.

Wow, that is very helpful of you and may completely satisfy my needs. I see that some checks didn't pass on it so I'll need to try it out carefully.

In the meantime, I still think it would be fair and useful to provide more information in README regarding what exactly it does and where, since some applications may be affected by specific implementation details.

@amenzhinsky
Copy link
Owner

I see that some checks didn't pass

Should be fine now

@Helyk
Copy link
Author

Helyk commented Sep 6, 2021

Oh I actually can't get it through go get since there's no release.

@amenzhinsky
Copy link
Owner

go get -u github.com/amenzhinsky/go-memexec@master

but it makes sense to add a new tag now

@Helyk
Copy link
Author

Helyk commented Sep 7, 2021

Thanks a lot, it works and does what I need. I will leave the issue open as I still think it would be useful to extend the description in README. Close it if you think it's not needed.

@epiccucumber15
Copy link

Hi @amenzhinsky

You said that "the package does execute code from the memory" but it still writes to the temp directory on Windows. Can I ask why this is necessary?

@amenzhinsky
Copy link
Owner

Hi @epiccucumber15

This is compatibility layer for all GOOS'es that don't have os-specific implementation in the package, like Linux, that uses memfd technique that is not available on other platforms.

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

3 participants