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

borg 1.4 freebsd acl code does not compile on freebsd 13 #8269

Open
ThomasWaldmann opened this issue Jul 3, 2024 · 13 comments
Open

borg 1.4 freebsd acl code does not compile on freebsd 13 #8269

ThomasWaldmann opened this issue Jul 3, 2024 · 13 comments
Labels
filesystem help wanted os: bsd FreeBSD, NetBSD, OpenBSD, ...
Milestone

Comments

@ThomasWaldmann
Copy link
Member

The code does not compile on freebsd 13 due to using acl_extended_link_np to determine whether a file has ACLs beyond what the normal user/group/mode bits can express.

See src/borg/platform/freebsd.pyx.

So it seems the currently the minimum requirement for borg 1.4 on freebsd is freebsd >= 14.

@ThomasWaldmann ThomasWaldmann added this to the 1.4.1 milestone Jul 3, 2024
@ThomasWaldmann ThomasWaldmann added the os: bsd FreeBSD, NetBSD, OpenBSD, ... label Jul 3, 2024
@ThomasWaldmann
Copy link
Member Author

I am not familiar with freebsd and ACLs on freebsd, so it would be good if a freebsd user / developer could help with this.

@ThomasWaldmann
Copy link
Member Author

Workaround for freebsd 13 borg users: use borg 1.2.x for now.

@mandree
Copy link

mandree commented Jul 24, 2024

The code comment also says to look at acl_is_trivial_np() - which has been around since 2009 so should be in FreeBSD 13. This is what FreeBSD 14.0's acl_extended_file_np and acl_extended_link_np are implemented like, and for the mainline (FreeBSD 15-CURRENT) you can select "main" in the upper right hand box. It basically looks if it's NFS4 or else just uses this acl_is_trivial_np().

https://cgit.freebsd.org/src/tree/lib/libc/posix1e/acl_extended_file_np.c?h=releng/14.0

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Jul 24, 2024
- Mark broken on FreeBSD 13 due to borgbackup/borg#8269
  which upstream maintainer intends to fix for borgbackup 1.4.1 (milestone).
  Reported by "Support SimpleRezo" in direct e-mail message.

- Add UPDATING entry. The broken MOVED entry has been removed by sunpoet@ already,

Reported by:	Juraj Lutter <otis@>, freebsd@rail.eu.org
PR:		280424

- Move py-pkgconfig to BUILD_DEPENDS to fix build failures in poudriere
  or on bare metal if py-pkgconfig isn't installed.

Reported by:	Juraj Lutter <otis@>, Hyogeol Lee <hyogeollee@gmail.com> (patch)
PR:		280413
@mandree
Copy link

mandree commented Jul 26, 2024

I've fixed the FreeBSD port to support FreeBSD 13.3 by importing said file, so people using FreeBSD's latest packages should be good as of the upcoming 1.4.0_1, or can build from source today.

netgate-git-updates pushed a commit to pfsense/FreeBSD-ports that referenced this issue Jul 26, 2024
import acl_extended_file_np.c from src/lib/libc/posix1e,
taken from FreeBSD src branch as of 559a218c9b25, 2023-11-01T16:43:37Z
and tell Cython to include it on FreeBSD before 1400033,
i. e., before FreeBSD's libc had it.

This fixes borgbackup/borg#8269 and
makes it unnecessary to look into
PR:		280453
@ThomasWaldmann
Copy link
Member Author

@mandree If you use freebsd and know about that stuff, can you fix the freebsd platform code in borg in a PR?

@mandree
Copy link

mandree commented Jul 27, 2024

@ThomasWaldmann feasible, but please help me help you because I am rather unfamiliar with Cython still, and we need to decide and do something in your repo that I can solve trivially by different means in the FreeBSD ports framework, which defines a Makefile variable "OSVERSION" by default, and I depend on that to decide whether to inject the libc source code file and patch setup.py to list it on that.

We need to import the missing function only on older FreeBSD versions, and to find out if we are on an "older" version, we have a few options, please help me choose the right one in your context: Either we

  • live with the current solution that only the official FreeBSD port I maintain supports FreeBSD 13.x (which is currently expected to go out of support end of April 2026), and let upstream move into the future without historic ballast,
  • or look at FreeBSD's major version and do something if it's 13 explicitly (12 isn't supported any more),
  • or, at configure time, test build and link a small C program that attempts to use the function, and if that fails, adds that .c file to the build (this is what I do not know yet how to formulate in Cython while I am proficient in Python, C++, C - I would have to get acquainted with Cython in far more detail than I currently care)
  • or, in C - #include <sys/param.h> and look at one of the macros, __FreeBSD_version (of course we could use that in the source file, too, and build it unconditionally, which I would however like to avoid because then we need to revert that change once FreeBSD 13 goes out of support)

Further sources

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Jul 31, 2024

@mandree Hmm, maybe it would be easier to just use api calls that are also present on freebsd13? I wasn't even aware that I am using something that new when I implemented these changes...

@mandree
Copy link

mandree commented Aug 8, 2024

Of course... if you want to change your source code, acl_is_trivial_np() is available on 13.3 as mentioned previously and as you can see in the acl_extended_file_np.c implementation file on 14.0 that I've linked to one message earlier.

But the FreeBSD port itself is already fixed and builds binary packages, too, so people can just run "pkg install py311-borgbackup" on supported FreeBSD 13 releases, too, and will get Borg Backup 1.4.0. Or "pkg install py311-borgbackup12" to get the prior version, 1.2.8. So I am not sure if you want to solve an issue again that I've fixed downstream in our FreeBSD packaging.

@ThomasWaldmann
Copy link
Member Author

Note: This needs a PR from some freebsd user/developer to fix the borg acl code so it is freebsd 13 compatible. The fix should be to use only api calls that exist on fbsd < 13 AND to test these fixes (with the borg test suite and also practically).

@mikae1
Copy link

mikae1 commented Oct 11, 2024

Workaround for freebsd 13 borg users: use borg 1.2.x for now.

Is borg 1.4.x “backward compatible”? That is, will borg 1.2.x work as source with a borg 1.4.0 installation that's used as a target for backups? The package manager on my Linux box will be stuck on the latest stable (1.4.x).

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Oct 11, 2024

@mikae1 yes, that should work. Just make sure to use borg >= 1.2.5 (see the upgrade / CVE notes at the top of the changelog), using borg clients <= 1.2.4 together with clients >= 1.2.5 (including 1.4.x) can be problematic due to bugs in <= 1.2.4.

@mikae1
Copy link

mikae1 commented Oct 11, 2024

@mikae1 yes, that should work. Just make sure to use borg >= 1.2.5 (see the upgrade / CVE notes at the top of the changelog), using borg clients <= 1.2.4 together with clients >= 1.2.5 (including 1.4.x) can be problematic due to bugs in <= 1.2.4.

Great, thanks for the swift reply! While I have you on the line… Will borg 1.4.x work as source with a 1.2.5 destination too?

@ThomasWaldmann
Copy link
Member Author

Yes, that should also work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filesystem help wanted os: bsd FreeBSD, NetBSD, OpenBSD, ...
Projects
None yet
Development

No branches or pull requests

3 participants