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

Develop libdwarfs (like libsquashfs) that will allow to use dwarfs without fuse #1

Closed
maxirmx opened this issue Sep 6, 2021 · 15 comments · Fixed by #38
Closed

Develop libdwarfs (like libsquashfs) that will allow to use dwarfs without fuse #1

maxirmx opened this issue Sep 6, 2021 · 15 comments · Fixed by #38
Assignees

Comments

@maxirmx
Copy link
Member

maxirmx commented Sep 6, 2021

No description provided.

@maxirmx maxirmx self-assigned this Sep 6, 2021
@ronaldtse ronaldtse transferred this issue from tamatebako/tebako Sep 17, 2021
@maxirmx
Copy link
Member Author

maxirmx commented Sep 21, 2021

Issues to be resolved in order to apply libdwarfs for tebako ruby packager

  1. dwarfs is C++ library. Ruby is C program. Normally calling C++ from a program with C start-up is not possible. So some kind of C++ startup wrapper will be required in order to link libdwarfs to ruby.
  2. dwarfs code is not ported to Windows and Mac. Porting may be a challenge because of multiple dependencies on complex Facebook and Google
  3. dwarfs implements inode operations. Ruby requires file operations. Practically it means that that libdwarfs needs to implement fuse functionality -- translate file operations to inode metadata and inode operations
  4. inodes is not something supported by Windows. It is not clear whether it is an issue

@ronaldtse
Copy link

@maxirmx Will a structure like this work?

Typical FUSE

Tebako vs FUSE - Typical FUSE

Tebako with internal and external image redirection

Tebako vs FUSE - Tebako

@maxirmx
Copy link
Member Author

maxirmx commented Sep 24, 2021

It will work.
However as far as I understood glibc redirection (as in retrace) requires dynamic linking (shared library)
You will have to distribute a package that includes several files

@maxirmx
Copy link
Member Author

maxirmx commented Sep 25, 2021

What we have as of Sept 25th 2021:

AsIs

We have it because the project started with tamatebako/tebako#2

@maxirmx
Copy link
Member Author

maxirmx commented Sep 25, 2021

ToBe

This will be "organic" change from using libdwarfs with FUSE wrapper towards using libdwarfs with out new wrapper

@maxirmx
Copy link
Member Author

maxirmx commented Sep 25, 2021

@ronaldtse we already have libdwarfs as explained above. This new libray will be libdwarfs wrapper that will provide inode <-> fd description. I believe it requires some other name. In ruby packer they just copy-paste files from squashFS but I do no believe it makes any sence.

Also the idea with glibc redirector contradicts your requirement to have statically lined single binary. Both requirement can be met but not together.

@ronaldtse
Copy link

the idea with glibc redirector contradicts your requirement to have statically lined single binary. Both requirement can be met but not together.

I understand the potential contradiction. The goal is to have a single binary wrapping that allows a Ruby program with its dependencies to run, so it's not really about static / dynamic. If a dynamically compiled Ruby is linked with other dependencies wrapped within a Tebako package, to the user they are self-contained and hence achieving what we need.

@ronaldtse
Copy link

What we have as of Sept 25th 2021:
We have it because the project started with tamatebako/tebako#2

My only concern is that it requires the FUSE kernel module to be loaded, by default Linux and Macs don't have that enabled. So it's just the next step to also move that portion into user-space.

@maxirmx
Copy link
Member Author

maxirmx commented Sep 25, 2021

I understand the potential contradiction. The goal is to have a single binary wrapping that allows a Ruby program with its dependencies to run, so it's not really about static / dynamic. If a dynamically compiled Ruby is linked with other dependencies wrapped within a Tebako package, to the user they are self-contained and hence achieving what we need.

To access dwarFS image ruby needs glibc shared library that you want to place inside dwarFS image. This does not seem possible

@maxirmx
Copy link
Member Author

maxirmx commented Sep 25, 2021

My only concern is that it requires the FUSE kernel module to be loaded, by default Linux and Macs don't have that enabled. So it's just the next step to also move that portion into user-space.

It is possible to eliminate FUSE dependency. I can patch ruby in the same way ruby-packer does.
(Actually I believe I know how to achieve much better packager performance)

@ronaldtse
Copy link

Patching the Ruby interpreter is acceptable.

Right now we already have a reasonable way of getting things working by:

  1. Patching the Ruby interpreter.
  2. The patched Ruby interpreter can be pre-built (once, by us) for all users

I was wondering whether we can "insert" a layer between the Ruby interpreter and its file reading functions.

@maxirmx
Copy link
Member Author

maxirmx commented Sep 25, 2021

I was wondering whether we can "insert" a layer between the Ruby interpreter and its file reading functions.

We will. It is called "ANewLibrary" in my diagram.
The difference we are discussing is the following:

  • with glibc module we would be patching glibc.so (binary, dynamically linked)
  • with ANewLibrary we will patch ruby interpreter source so that it will call "ANewLibrary" (statically linked)

@ronaldtse
Copy link

with glibc module we would be patching glibc.so (binary, dynamically linked)
with ANewLibrary we will patch ruby interpreter source so that it will call "ANewLibrary" (statically linked)

What are the considerations for better / more extensible for the future?

@maxirmx
Copy link
Member Author

maxirmx commented Sep 27, 2021

What are the considerations for better / more extensible for the future?

No opinion yet. Both involve some unconventional patching.
Anyway I have to start with a library that wraps existing libdwarfs and provides different interface.
Ruby or glibc patching is the next step. The wrapper is the same.

@maxirmx
Copy link
Member Author

maxirmx commented Sep 27, 2021

The list of C functions that shall be supported for Ruby packaging: #3

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

Successfully merging a pull request may close this issue.

2 participants