Fix macOS build, process leaks, extension handling, plug, and add CI #16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/homebrew-libmagic-paths"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Started as a fix for macOS Homebrew libmagic build paths, grew into a broader bugfix pass focused on issues that affect Pleroma in production.
Build & CI
pkg-configto discover libmagic paths (fixes macOS Homebrew build)ei_init()call that crashes on macOS with unlimited fd limit/dev/nullunlessMAJIC_DEBUGis setProcess Leaks
Once.perform/3: clean up server process on error (try/after)Pool.terminate_worker/3: stop server processes on pool shutdownExtension.fix
dir/prefix).JPEGnow matches.jpeg)Plug
transform_uploads— oldcollect_uploads/put_in_if_existsbroke on nested maps/arraysfix_extensionoptionServer
reload/recyclecalls in non-available states (was crashing){:data, _}in recycling state (was crashing):eaccess→:eaccestypo in errno mapterminate/3against nil portMajic.performonce path ignoring:timeoutoptionDocs
Tests
.mgc(cross-version compatible)Testing
mix test --tracepasses on macOS (ARM64, Homebrew)mix format --check-formattedpassesmix credopasses (0 issues)elixir:1.17-alpinefull suite passes (43 tests, 0 failures)- Fix Once.perform/3 server process leak on error (try/after) - Fix Pool.terminate_worker/3 not stopping worker servers - Fix server timeouts using bare integers instead of :state_timeout - Postpone reload/recycle in non-available states - Guard Server.terminate/3 against nil port - Validate Server.perform/3 input, return {:error, :badarg} - Fix :eaccess -> :eacces errno mapping - Fix C atom buffer too small (128 -> MAXATOMLEN) - Fix C fdseek mixing read(2) and getchar() - Fix C header read robustness (read_exact, unsigned char casts) - Check C ei_get_type return values - Free C ei_x_buff on reload early return - Add NULL checks for magic_file/magic_buffer return values - Fix Extension.fix/3 stripping directory paths - Fix Extension.fix/3 mishandling uppercase extensions - Fix Extension.fix/3 trailing dot with no candidates - Fix Majic.perform once:true ignoring :timeout option - Rewrite Majic.Plug with recursive transformation - Enable previously skipped Plug test - Add new tests for process leaks, invalid input, oversized packetsPath.join('.', x) prepends './' so use dir != '.' guard. Use Path.basename(name) for append branches to avoid including directory in the filename portion being appended to.Processing state now handles :exit_status and :closed port messages, replying with {:error, :port_exit} / {:error, :port_closed} and transitioning to :starting. Recycling state now postpones late {:data, _} messages instead of crashing.Catch :exit {:timeout, _} from NimblePool.checkout!/3 and return {:error, :timeout} instead of crashing the caller.be0dd96941tofc689178abCalling reload or recycle during processing/starting/loading/recycling previously crashed the server. Now these calls are postponed until the server returns to :available. Also discard late {:data, _} messages in recycling state instead of crashing. Fix :eaccess -> :eacces typo and add is_port guard in terminate/3.Use pkg-config to discover libmagic pathsto Fix macOS build, process leaks, extension handling, plug, and add CI8742cc7f70dbd654d0e6