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

berkeley-db: Build db_dump185 compatibility util #191419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trinitronx
Copy link
Contributor

The --enable-dump185 Builds the db_dump185 utility, which can dump Berkeley DB 1.85 and 1.86 databases. MacOS and BSD variants such as FreeBSD still use this version in certain system files such as /private/etc/aliases.db /etc/pwd.db, /etc/spwd.db, /etc/login.conf.db and others.

See: https://docs.oracle.com/cd/E17275_01/html/programmer_reference/build_unix_conf.html#build_unix_conf

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

Copy link
Contributor

Thanks for contributing to Homebrew! 🎉 It looks like you're having trouble with a CI failure. See our contribution guide for help. You may be most interested in the section on dealing with CI failures. You can find the CI logs in the Checks tab of your pull request.

@trinitronx
Copy link
Contributor Author

trinitronx commented Sep 21, 2024

Note: Just needs libdb-dev ^libdb1-compat on Linux for db.h header file + libdb1.

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Oct 12, 2024
@trinitronx
Copy link
Contributor Author

@github-actions Bump

Working on other things at the moment... will get back around to this

@github-actions github-actions bot removed the stale No recent activity label Oct 15, 2024
@github-actions github-actions bot added the autosquash Automatically squash pull request commits according to Homebrew style. label Oct 23, 2024
@trinitronx trinitronx force-pushed the enable-berkeley-db-dump185 branch from 1f430e5 to 679e02a Compare October 23, 2024 22:50
@github-actions github-actions bot removed the autosquash Automatically squash pull request commits according to Homebrew style. label Oct 23, 2024
@trinitronx
Copy link
Contributor Author

@chenrui333: This is now ready for review! 🎉

Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, a few comments/questions.

args = %W[
--disable-debug
--disable-static
--prefix=#{prefix}
--mandir=#{man}
--enable-cxx
--enable-compat185
--enable-dump185
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like a huge pain to install this on Linux. Can we just do it on macOS?

Copy link
Contributor Author

@trinitronx trinitronx Oct 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just do it on macOS?

Possibly, although then it would not be in feature parity with the already built macOS binaries. From time to time, I find myself on Linux needing some BSD-specific tool (or vice versa). The idea was to keep things working the same across different OS for a better user experience. A big plus!

Also, I did spend a few days doing all the hard work already. 😅 🤷

It seems like a huge pain to install this on Linux.

While it might seem like this at first glance, the simpler-looking alternatives were either not supported 1, or Debian-specific (and hiding complexity). Plus, I figured the policy for Linuxbrew would be to keep things building independently without tying into system dependencies on one distro or another.

This avoids locking to Debian build tools, which would have the usual simpler-looking apt-get build-dep ..., apt-get source ..., debuild method 2. Otherwise, just installing apt-get install libdb1-compat and building against system libs worked but then again only works on Debian-based distros and creates a build dependency on something outside Homebrew.

The usual method on Debian is to unpack the .orig.tar.gz and .debian.tar.xz files and just run debuild, which applies all the patches inside the unpacked debian/patches directory which came from the *.debian.tar.xz archive. We could have done that here with system commands and it would look cleaner, but then it would depend on Debian-specific build tools and increase the build dependencies needed.

Footnotes

  1. At first, I tried using patch with apply %W [ ... ] nested inside the resource block for the debian source code, simlar to how mytop does with a top-level .debian.tar.xz Formula patch. However, nesting this to patch another resource didn't appear to be supported in the current Ruby Formulary DSL. Also, patch only expected a single patch via URL or possibly more via :DATA with an embedded __END__ section. Although, using that wouldn't be ideal because all patches are already from upstream and we'd need to then duplicate & maintain them in this Formula to use :DATA. Although it didn't work, it would've looked much simpler if we could nest them like:

    resource 'foo' do
      url '... source code tar.gz ...'
      ...
      patch do
        url '... debian.tar.xz with patches inside ...'
    
        apply %W[ ... list of files in debian/patches to apply ... ]
      end
    end
    
  2. While this might look simple, it hides complexity and also yields more build dependencies. For example: debuild internally applies the debian/patches via quilt push -a, runs dpkg-buildpackage and more, hiding all the complexity inside one command. Yet, again this uses more Debian-specific packaging tools internally which increases the build dependency list and locks it into only working on Debian-based distros.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate that you've done a lot of work here, but keeping this around just isn't very maintainable. Sorry!

If you need db_dump185 on Linux, I suggest hosting a version of this formula in your own tap.

@trinitronx trinitronx force-pushed the enable-berkeley-db-dump185 branch from 679e02a to 7880954 Compare October 24, 2024 21:46
The --enable-dump185 Builds the db_dump185 utility, which can dump
Berkeley DB 1.85 and 1.86 databases. MacOS and BSD variants such as FreeBSD
still use this version in certain system files such as `/private/etc/aliases.db`
`/etc/pwd.db`, `/etc/spwd.db`, `/etc/login.conf.db` and others.

See: https://docs.oracle.com/cd/E17275_01/html/programmer_reference/build_unix_conf.html#build_unix_conf

berkeley-db: Fix db_dump185 build on Linux

References:

- Oracle's build docs: https://www.oracle.com/technetwork/database/berkeleydb/bdb-installation-160957.pdf#page=66
- Debian's libdb1.85 source: https://packages.debian.org/sid/libdb1-compat
- Security bug fixed in Debian's libdb1-compat: https://insecure.org/sploits/libdb.snprintf.redefine.html
@trinitronx trinitronx force-pushed the enable-berkeley-db-dump185 branch from 7880954 to 69b0d3a Compare October 24, 2024 21:48
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Nov 15, 2024
@trinitronx
Copy link
Contributor Author

@github-actions Bump

@github-actions github-actions bot removed the stale No recent activity label Nov 15, 2024
Copy link
Contributor

github-actions bot commented Dec 7, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Dec 7, 2024
@trinitronx
Copy link
Contributor Author

@github-actions Bump

@github-actions github-actions bot removed the stale No recent activity label Dec 7, 2024
@chenrui333 chenrui333 added in progress Stale bot should stay away maintainer feedback Additional maintainers' opinions may be needed labels Dec 25, 2024
@p-linnane p-linnane requested a review from a team December 25, 2024 06:31
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @carlocab. I'm 👍🏻 to doing this on macOS and 👎🏻 to doing it on Linux (until it's more like a 2-3 line diff)

@cho-m cho-m added needs response Needs a response from the issue/PR author and removed in progress Stale bot should stay away labels Feb 5, 2025
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer feedback Additional maintainers' opinions may be needed needs response Needs a response from the issue/PR author stale No recent activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants