Skip to content

Conversation

@dependabot
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 3, 2025

Bumps fork from 0.3.1 to 0.4.0.

Changelog

Sourced from fork's changelog.

0.4.0

Breaking Changes

  • Improved error handling - All functions now return io::Result instead of Result<T, i32>
    • fork() now returns io::Result<Fork> (was Result<Fork, i32>)
    • daemon() now returns io::Result<Fork> (was Result<Fork, i32>)
    • setsid() now returns io::Result<libc::pid_t> (was Result<libc::pid_t, i32>)
    • getpgrp() now returns io::Result<libc::pid_t> (was Result<libc::pid_t, i32>)
    • waitpid() now returns io::Result<()> (was Result<(), i32>)
    • chdir() now returns io::Result<()> (was Result<libc::c_int, i32>)
    • close_fd() now returns io::Result<()> (was Result<(), i32>)

Major Improvements

  • Fixed file descriptor reuse bug (Issue #2)
    • Added redirect_stdio() function that redirects stdio to /dev/null instead of closing
    • Prevents silent file corruption when daemon opens files after stdio is closed
    • daemon() now uses redirect_stdio() instead of close_fd()
    • Matches industry standard implementations (libuv, systemd, BSD daemon(3))

Benefits

  • Better error diagnostics - Errors now capture and preserve errno values
  • Rich error messages - Error display shows descriptive text (e.g., "Permission denied") instead of -1
  • Rust idioms - Integrates seamlessly with ? operator, anyhow, thiserror, and other error handling crates
  • Type safety - Can match on ErrorKind variants for specific error handling
  • Debugging - .raw_os_error() provides access to underlying errno when needed
  • Correctness - No more file descriptor reuse bugs that could corrupt data files

Added

  • Fork enum now derives Debug, Clone, Copy, PartialEq, Eq for better usability
  • redirect_stdio() function - Safer alternative to close_fd()
  • Comprehensive tests for stdio redirection (tests/stdio_redirect_tests.rs)
    • Test demonstrating the fd reuse bug with close_fd()
    • Tests verifying redirect_stdio() prevents fd reuse
    • Tests confirming daemon() uses correct behavior

Improved

  • Simplified close_fd() implementation using iterator pattern
  • Enhanced documentation with detailed error descriptions for all functions
  • Updated all examples to use proper error handling patterns
  • Added warnings to close_fd() documentation about fd reuse risks

Security

  • CRITICAL FIX: daemon() no longer vulnerable to file descriptor reuse bugs
    • Previously, files opened after daemon(false, false) could get fd 0, 1, or 2
    • Any println!, eprintln!, or panic would write to those files, corrupting them
    • Now stdio is redirected to /dev/null, keeping fd 0,1,2 occupied
    • New files always get fd >= 3
Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Nov 3, 2025
@github-actions github-actions bot enabled auto-merge (squash) November 3, 2025 10:08
@dependabot dependabot bot force-pushed the dependabot/cargo/fork-0.4.0 branch from 49e9a2c to 127069c Compare November 3, 2025 10:22
@dependabot dependabot bot force-pushed the dependabot/cargo/fork-0.4.0 branch from 127069c to 617fb66 Compare November 10, 2025 13:32
@dependabot dependabot bot force-pushed the dependabot/cargo/fork-0.4.0 branch 3 times, most recently from 749d14c to 18b4854 Compare November 20, 2025 10:10
@dependabot dependabot bot force-pushed the dependabot/cargo/fork-0.4.0 branch 3 times, most recently from 3e22a45 to 8487672 Compare November 28, 2025 10:14
Bumps [fork](https://github.com/immortal/fork) from 0.3.1 to 0.4.0.
- [Changelog](https://github.com/immortal/fork/blob/main/CHANGELOG.md)
- [Commits](immortal/fork@0.3.1...0.4.0)

---
updated-dependencies:
- dependency-name: fork
  dependency-version: 0.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/cargo/fork-0.4.0 branch from 8487672 to a3cdc15 Compare December 1, 2025 12:51
@dependabot @github
Copy link
Contributor Author

dependabot bot commented on behalf of github Dec 8, 2025

Superseded by #1546.

@dependabot dependabot bot closed this Dec 8, 2025
auto-merge was automatically disabled December 8, 2025 10:05

Pull request was closed

@dependabot dependabot bot deleted the dependabot/cargo/fork-0.4.0 branch December 8, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants