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
Discussion: fpm, ruby, ffi version conflicts #1795
Comments
In hindsight, removing
|
I asked upstream for guidance, if any, and got a somewhat confusing response -- maybe I didn't provide enough context... ffi/ffi#906 |
Removing Lines 39 to 41 in 72a925b
In particular for freebsd.rb, replacing this section with non-ffi code: https://github.com/jordansissel/fpm/blob/master/lib/fpm/package/freebsd.rb#L85-L95 |
Research on Until very recently,
Other file special types are not addressed. I tested unix sockets in both stream and datagram modes, and both create the same exact kind of file, so it seems like the UNIXServer.new(...).close is a good solution for "copying" unix sockets. I don't know how old Because of the |
Looks like exec'ing |
For safesystem() and safesystemout(), let's see ... Both methods invoke
|
For some other background on my thought process -- This scenario is a complex one due to the following:
The objective is to keep |
The childprocess library uses `ffi`. Historically, installing ffi has brought challenges for fpm users. This change is an attempt to use ruby standard methods to replace ChildProcess. For #1795
This removes fpm's direct use of FFI and removes `ffi` as a direct dependency. For #1795 Cases: * A unix socket. * A named pipe * A charDev should now fail (like /dev/tty) * A blockDev should now fail (like /dev/sda1) NOTE: In this change, chardev and blockdev support have been removed. These "copies" previously were just calling `mknod` with identical mode, basically copying the `mode` from stat(2) to mknod(2). Exceptions are now thrown for chardev and blockdev. Test cases: # Try to package a named pipe. % mkfifo /tmp/z.pipe % bundle exec bin/fpm -s dir -t rpm -n example /tmp/z.pipe Created package {:path=>"example-1.0-1.x86_64.rpm"} % rpm -qlvp example-1.0-1.x86_64.rpm prw-rw-r-- 1 root root 0 Jun 17 22:40 /tmp/z.pipe # Create the unix socket % nc -lU /tmp/z.sock # Package it into an rpm % bin/fpm -s dir -t rpm -n example /tmp/z.sock |& less {:timestamp=>"2021-06-17T22:33:27.780347-0700", :message=>"Created package", :path=>"example-1.0-1.x86_64.rpm"} # Verify the file is of socket type ('s' at beginning of file mode % rpm -qlvp example-1.0-1.x86_64.rpm srwxrwxr-x 1 root root 0 Jun 17 22:33 /tmp/z.sock
For #1795 This replaces another library which uses ffi with an implementation that doesn't need ffi. I am not certain this is an exact replacement, but for my casual tests, comparing .txz files generated before/after this commit, things seem ok. This would benefit from real freebsd testing, though.
The childprocess library uses `ffi`. Historically, installing ffi has brought challenges for fpm users. This change is an attempt to use ruby standard methods to replace ChildProcess. For #1795
This removes fpm's direct use of FFI and removes `ffi` as a direct dependency. For #1795 Cases: * A unix socket. * A named pipe * A charDev should now fail (like /dev/tty) * A blockDev should now fail (like /dev/sda1) NOTE: In this change, chardev and blockdev support have been removed. These "copies" previously were just calling `mknod` with identical mode, basically copying the `mode` from stat(2) to mknod(2). Exceptions are now thrown for chardev and blockdev. Test cases: # Try to package a named pipe. % mkfifo /tmp/z.pipe % bundle exec bin/fpm -s dir -t rpm -n example /tmp/z.pipe Created package {:path=>"example-1.0-1.x86_64.rpm"} % rpm -qlvp example-1.0-1.x86_64.rpm prw-rw-r-- 1 root root 0 Jun 17 22:40 /tmp/z.pipe # Create the unix socket % nc -lU /tmp/z.sock # Package it into an rpm % bin/fpm -s dir -t rpm -n example /tmp/z.sock |& less {:timestamp=>"2021-06-17T22:33:27.780347-0700", :message=>"Created package", :path=>"example-1.0-1.x86_64.rpm"} # Verify the file is of socket type ('s' at beginning of file mode % rpm -qlvp example-1.0-1.x86_64.rpm srwxrwxr-x 1 root root 0 Jun 17 22:33 /tmp/z.sock
For #1795 This replaces another library which uses ffi with an implementation that doesn't need ffi. I am not certain this is an exact replacement, but for my casual tests, comparing .txz files generated before/after this commit, things seem ok. This would benefit from real freebsd testing, though.
Resolved by #1796. Released with fpm 1.13.0 |
The spread of ruby versions, platforms, and dependencies is making it harder and harder to provide a good user experience when installing and using fpm.
Problem situation:
In #1709, we pinned a dependency ffi to the 1.12.x branch to enable support for Ruby 2.2 and older. However, this causes problems for Apple M1 OSX users who need ffi 1.14 or newer. Further, some platforms distributing Ruby 3.0 will only make newer versions of ruby ffi available. If we allow any version newer than 1.12, these older rubies will likely still fetch the newer-and-incompatible ffi versions.
This is largely an impossible situation where a "simple" solution needlessly punishes some population of users. Do we make it harder for Mac users? or do we make it harder for CentOS 7 users? It's a tough situation just leaving me feeling sour.
This crossroads is giving me some pause. I'm not sure exactly what solution will come.
Focusing just on ffi, I wonder if we can remove
ffi
as a dependency?If I look at the Gemfile.lock for the dependency tree, I see that fpm has dependencies on
ruby-xz
andchildprocess
both of which require ffi.require "xz"
require "childprocess"
mknod
If we can replace these, fpm's need for
ffi
is eliminated.The text was updated successfully, but these errors were encountered: