-
Notifications
You must be signed in to change notification settings - Fork 69
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 for dwarfs-like -o offset=auto? #138
Comments
Oh this is fascinating. So my understanding is that dwarfs or pelf work by searching for a magic string? That's clever but a bit scary for two reasons:
Would it make sense instead for pelf to calculate the offset at creation-time? Eg:
This way, you not only avoid calculating the offset in bash at startup time, you avoid any time spent searching at runtime. Running is likely much more common than creating, so overall this should be a big benefit. |
I considered writting a patch to add this feature myself, but then that means that this won't be available in other systems, nor through package managers. I hope you consider it and maybe add a note/warning that says that it may be unsafe. |
I agree with @vasi above that this would be best done by precomputing the offset at build time. That's what XAR does. but in the short term, you could probably get a significant performance boost on large images by simply stopping the search for your archive marker when you hit one, instead of searching the whole archive, and asking grep to give you byte offset: _VAR_ARCHIVE_MARKER=$(grep -a -n "^ARCHIVE_MARKER" "$0" | cut -d: -f1) -> _VAR_ARCHIVE_MARKER=$(grep -a -b -m1 "^ARCHIVE_MARKER" "$0" | cut -d: -f1) |
I'm limited to POSIX options ... And calculating at runtime is too slow, and doing it during the build/generation step would be best, however, this is shell and I'm trying to keep things manageable. |
Hi! Thanks for this awesome project. I've been using it for my AppBundle format, at https://github.com/xplshn/pelf, currently, I'm facing the issue that mounting sqfs.AppBundles is 300ms slower than mounting appimages, due to the fact that calculating the offset in shell takes too much time, I was wondering if a built-in option to do this could be considered. Or perhaps, using a custom header that the user may indicate, such as:
I may append:
This way, I could provide -o offset="SQFS_MARKER" and it'd find the SQFS image just fine.
The text was updated successfully, but these errors were encountered: