Closed alecdwm closed 2 weeks ago
Thanks for flagging. The lack of checking in Gemfile.lock is somewhat intended as I know users were on different versions of Ruby and some gems, particularly Google's protobuf, have had their OWN breaking changes that required different versions in different versions of Ruby. I have not yet wanted to specify a Ruby version beyond "if it hasn't been end-of-lifed, it should work."
That said, I appreciate the heads up and will look at pushing a fix to this error with how execute is called.
The immediate issue of SQLite calls is addressed in a82014e01cf72bcb5852227d0fc08c5466f0356a. I will consider checking in a Gemfile that fits anything Ruby 3 and up.
Hey! Sounds good Great project btw 😀
There was another notable breaking change in the latest sqlite3-ruby:
Database#columns
returns a list of internal frozen strings.
This causes AppleNote::is_gzip
to raise a FrozenError
when it tries to call data.force_encoding
Adding .dup
should be all that's needed to fix it
- return data.force_encoding("US-ASCII").start_with?("\x1F\x8B".force_encoding("US-ASCII"))
+ return data.dup.force_encoding("US-ASCII").start_with?("\x1F\x8B".force_encoding("US-ASCII"))
This didn't cause the program to crash, but it did mean that all exported notes had an empty content section.
After I ran into that error, I stopped looking into trying to fix any issues with the new deps and instead started to see if I could just configure a stricter Gemfile.
By adding these version ranges I was able to get everything working without any changes to the program source (also, I was using ruby 3.2!):
diff --git a/Gemfile b/Gemfile
index a485721..f681cdd 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,22 +1,22 @@
source "https://rubygems.org"
# Gems owned by Ruby directly
-gem 'cgi',">= 0.3.3" # Ruby official
-gem 'fileutils', ">= 1.4.0" # Ruby official
-gem 'openssl', ">= 2.2.0" # Ruby official
-gem 'rake', ">= 10.5.0" # Ruby official
-gem 'zlib', ">= 1.1.0" # Ruby official
+gem 'cgi',"~> 0.3" # Ruby official
+gem 'fileutils', "~> 1.4" # Ruby official
+gem 'openssl', "~> 2.2" # Ruby official
+gem 'rake', "~> 13.2" # Ruby official
+gem 'zlib', "~> 1.1" # Ruby official
# Gems owned by Google
-gem 'google-protobuf', ">= 3.11.2" # Google official
+gem 'google-protobuf', "~> 4.26" # Google official
# Gems owned by some "organization" on GitHub
gem 'rspec' # Owned by rspec
-gem 'sqlite3', ">= 1.4.0" # Owned by SparkleMotion
+gem 'sqlite3', "~> 1.4" # Owned by SparkleMotion
# Gems with multiple possible maintainers
-gem 'nokogiri', ">= 1.14.0" # Multiple maintainers
-gem 'keyed_archive', ">= 1.0.0" # Owned by me and one other
+gem 'nokogiri', "~> 1.14" # Multiple maintainers
+gem 'keyed_archive', "~> 1.0" # Owned by me and one other
# Gems with just one maintainer
-gem 'aes_key_wrap', ">= 1.1.0" # Single owner: @tomdalling
+gem 'aes_key_wrap', "~> 1.1" # Single owner: @tomdalling
From what I could tell, ~> 1.1
is a shortcut for >= 1.1.0, < 2.0.0
Thanks for doing the hard work on that! I'm going to push make sure that Gemfile works with a few different versions on a clean installation and then push it, if so. It definitely will end support for Ruby 2.7 (which is end-of-lifed, I know, but there's possibly some other clean up to do for that). I want to make sure the database columns issue doesn't crop up anywhere else before I push that fix and call it good.
I appreciate the help!
Pushed the new Gemfile in e6d04752474d1bae9919367e4e7194c67a70d7e5 after building Docker images for Ruby 3.0 - 3.3 and testing it on a Mac.
The current Gemfile doesn't work for me on macOS 14.5 23F79 (Sonoma) MacBookPro18,2 (Apple M1 Max, arm64)
:
If I change part of Gemfile back to:
# Gems owned by Ruby directly
gem 'cgi',"~> 0.3" # Ruby official
gem 'fileutils', "~> 1.4" # Ruby official
gem 'openssl', ">= 2.2.0" # Ruby official
[…]
`
then installation works again:
Because
Gemfile.lock
is in the.gitignore
, it isn't included in this repo.Without the lockfile, a fresh clone of this repo will always
bundle install
the latest available version of each gem.This can lead to issues when breaking changes are released in one of the dependencies.
For example, the latest version of sqlite3-ruby has this change:
Which causes this error when running
notes_cloud_ripper.rb
:That specific error isn't too hard to fix, but there may be breaking changes in any of the other gems which don't necessarily cause the program to raise an error, but instead lead to
works-on-my-machine
-type bugs.Also there might be more breaking changes in the future!