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

samba: avoid conflicting with /usr/bin/{mdfind,profiles} #81592

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions Formula/samba.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Samba < Formula
url "https://download.samba.org/pub/samba/stable/samba-4.14.5.tar.gz"
sha256 "bb6ef5d2f16b85288d823578abc453d9a80514c42e5a2ea2c4e3c60dc42335c3"
license "GPL-3.0-or-later"
revision 1

bottle do
sha256 arm64_big_sur: "5825541d678648183fe2d19a49a63cb08d1b0686e6834390c39046442b945f52"
Expand All @@ -26,6 +27,13 @@ class Samba < Formula
sha256 "3810e998308fba2e0f4f26043035032b027ce51ce5c8a52a8b8e340ca65f13e5"
end

# Workaround for "charset_macosxfs.c:278:4: error: implicit declaration of function 'DEBUG' is invalid in C99"
# Can be removed when https://bugzilla.samba.org/show_bug.cgi?id=14680 gets resolved.
patch do
url "https://attachments.samba.org/attachment.cgi?id=16579"
sha256 "86fce5306349d1c8f3732ca978a31065df643c8770114dc9d068b7b4dfa7d282"
end

def install
# avoid `perl module "Parse::Yapp::Driver" not found` error on macOS 10.xx (not required on 11)
if MacOS.version < :big_sur
Expand All @@ -37,9 +45,6 @@ def install
system "make", "install"
end
end
# CFLAGS is for avoiding hitting https://bugzilla.samba.org/show_bug.cgi?id=14680 .
# Remove this CFLAGS when the patch ( https://attachments.samba.org/attachment.cgi?id=16579 ) gets merged.
ENV.append "CFLAGS", "-include #{buildpath}/lib/util/debug.h"
system "./configure",
"--disable-cephfs",
"--disable-cups",
Expand All @@ -65,14 +70,20 @@ def install
on_macos do
# macOS has its own SMB daemon as /usr/sbin/smbd, so rename our smbd to samba-dot-org-smbd to avoid conflict.
# samba-dot-org-smbd is used by qemu.rb .
mv "#{sbin}/smbd", "#{sbin}/samba-dot-org-smbd"
# Rename mdfind and profiles as well to avoid conflicting with /usr/bin/{mdfind,profiles}
{ sbin => "smbd", bin => "mdfind", bin => "profiles" }.each do |dir, cmd|
mv dir/cmd, dir/"samba-dot-org-#{cmd}"
end
end
end

def caveats
on_macos do
<<~EOS
macOS has its own SMB daemon as /usr/sbin/smbd, so Samba version of smbd is installed as "#{HOMEBREW_PREFIX}/sbin/samba-dot-org-smbd"
To avoid conflicting with macOS system binaries, some files were installed with non-standard name:
- smbd: #{HOMEBREW_PREFIX}/sbin/samba-dot-org-smbd
- mdfind: #{HOMEBREW_PREFIX}/bin/samba-dot-org-mdfind
- profiles: #{HOMEBREW_PREFIX}/bin/samba-dot-org-profiles

On macOS, Samba should be executed as a non-root user: https://bugzilla.samba.org/show_bug.cgi?id=8773
EOS
Expand Down