[Midnightbsd-cvs] [MidnightBSD/mports] c608a5: net/samba419: fix MidnightBSD platform detection a...

Lucas Holt noreply at github.com
Sat Sep 19 23:49:45 EDT 2026


  Branch: refs/heads/master
  Home:   https://github.com/MidnightBSD/mports
  Commit: c608a5c1755982dc8a9714d66ba1bc287059b3c9
      https://github.com/MidnightBSD/mports/commit/c608a5c1755982dc8a9714d66ba1bc287059b3c9
  Author: Lucas Holt <luke at foolishgames.com>
  Date:   2026-09-19 (Sat, 19 Sep 2026)

  Changed paths:
    A net/samba419/files/patch-nsswitch_wscript__build
    A net/samba419/files/patch-source3_wscript
    A net/samba419/files/patch-third__party_heimdal_kadmin_kadmin__locl.h
    A net/samba419/files/patch-third__party_heimdal_kcm_headers.h
    A net/samba419/files/patch-third__party_heimdal_kdc_headers.h
    A net/samba419/files/patch-third__party_heimdal_kpasswd_kpasswd__locl.h
    A net/samba419/files/patch-third__party_heimdal_lib_roken_rkpty.c

  Log Message:
  -----------
  net/samba419: fix MidnightBSD platform detection and libutil clash (#1486)

Two MidnightBSD-specific build problems in `net/samba419`. **Neither is
sufficient on its own to make samba build yet** — see *Status* below —
but both are real, independent bugs worth fixing on their own merits.

## 1. Platform detection

samba dispatches on `sys.platform`, which is **`midnightbsd4`** here,
using substring tests:

```python
host_os = sys.platform
...
elif (host_os.rfind('freebsd') > -1):
```

`"midnightbsd4"` does not contain `"freebsd"`, so MidnightBSD **fell
through every platform branch** in `source3/wscript` and
`nsswitch/wscript_build`. The visible symptom was configure aborting:

```
sendfile support not found but it was requested !
```

but it was also silently skipping:

- the `FREEBSD` define
- `STAT_ST_BLOCKSIZE`
- the `sunacl.h` / `HAVE_FREEBSD_SUNACL_H` check
- the winbind NSS plugin (`nss_winbind.so.1`) in
`nsswitch/wscript_build`

So even a build that got past sendfile would have been subtly wrong.

Rather than patch each of the ~8 `rfind('freebsd')` sites, this
normalises `host_os` once after each `sys.platform` assignment so the
existing branches apply:

```python
if host_os.rfind('midnightbsd') > -1:
    host_os = host_os.replace('midnightbsd', 'freebsd')
```

MidnightBSD is FreeBSD-derived, so taking those branches is semantically
correct. Configure now reports `Checking for freebsd sendfile support:
ok`.

`lib/replace/wscript` and `source4/ntvfs/sysdep/wscript_configure` also
read `sys.platform` but never test for freebsd, so they need nothing.

## 2. libutil clash

MidnightBSD's `libutil.h` declares `easprintf()` and `evasprintf()`;
FreeBSD's does not. By the time `<libutil.h>` is included, `roken.h` has
already done `#define evasprintf rk_evasprintf`, so libutil's
declaration is renamed into a conflicting one:

```
/usr/include/libutil.h:155:6: error: conflicting types for 'rk_evasprintf'
```

The two are not interchangeable:

| | signature |
|---|---|
| heimdal `rk_evasprintf` | `char *(const char *, va_list)` |
| MidnightBSD libutil `evasprintf` | `int (char **, const char *,
va_list)` |

so heimdal has to keep its own. The fix hides the macros across the
include with `#pragma push_macro`/`pop_macro` and restores them
afterwards, in all five headers that include `<libutil.h>`:
`kdc/headers.h`, `kadmin/kadmin_locl.h`, `kcm/headers.h`,
`kpasswd/kpasswd_locl.h`, `lib/roken/rkpty.c`.

## Status

**samba419 still does not build.** Both fixes above are verified working
— sendfile is detected and the `rk_evasprintf` conflict is gone — but
with the platform fix in place the FreeBSD branch now enables
`vfs_zfsacl`, which was previously never compiled here:

```
source3/modules/vfs_zfsacl.c:99: error: use of undeclared identifier 'ACE_INHERITED_ACE'
```

That constant arrives in `sysutils/libsunacl` **1.0.1**; mports has
**1.0**. Updating it is the next step and is deliberately **not** in
this PR — FreeBSD's libsunacl also moved `MASTER_SITES` to GitHub
releases and added `USES= uidfix`, while mports carries local content
(`FAKE_OPTS= trueprefix`, the `OSVERSION < 4000` guard, `NO_PROFILE`
plist handling) that needs preserving.

These two fixes are independent of that work and correct regardless of
how the libsunacl update lands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01NSsgED5s7GPYJNb1HxuaU9

## Summary by Sourcery

Fix MidnightBSD compatibility issues in Samba's platform detection and
Heimdal header integration.

Bug Fixes:
- Fix MidnightBSD platform detection so Samba applies the appropriate
FreeBSD build configuration and enables sendfile and winbind NSS
support.
- Prevent MidnightBSD libutil declarations from conflicting with
Heimdal's renamed formatting functions.

Signed-off-by: Lucas Holt <luke at foolishgames.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/mports/settings/notifications



More information about the Midnightbsd-cvs mailing list