# Running ApplixWare, including Presents

**The short version.** ApplixWare's old libraries needed help with signal handling and account lookup. A small adapter, **shim 02**, supplies that help. Testing Words, the word processor, also exposed a problem caused by using modern X11 libraries. Selecting old X11 and a writable application copy opened Words on FreeBSD 16. The user reports that this work led to everything running, including **Presents**, the main goal.

Contents:

- [§1. Identify the starting setup](#1-identify-the-starting-setup).
- [§2. Prepare a separate test copy](#2-prepare-a-separate-test-copy).
- [§3. Follow the failures](#3-follow-the-failures).
- [§4. Select old X11 and shim 02](#4-select-old-x11-and-shim-02).
- [§5. Verify Words, then run Presents](#5-verify-words-then-run-presents).
- [Appendix A. Complete shim source](#appendix-a-complete-shim-source).
- [Appendix B. Saved evidence](#appendix-b-saved-evidence).

**How to read the evidence:** **selected output** retains unchanged lines from a longer capture; **verbatim output** quotes a complete message; **annotated reconstruction** explains or summarizes the evidence. Commands marked **reproduction** assemble the recorded test settings into instructions; they are not a transcript of one shell session. Historical results are identified separately.

## 1. Identify the starting setup

This investigation starts with Applix already installed, its 32-bit runtime and supporting libraries available, and a working X display. X11 is the window system Applix uses. A **library** supplies operations such as drawing windows or reading account information.

The relevant files are:

| File or directory | Purpose |
|---|---|
| `/usr/local/applixware` | Installed application and fonts. |
| `/usr/local/lib32/compat` | Old supporting libraries. |
| `/usr/lib32` | Modern 32-bit system libraries. |
| `/usr/local/lib/libc3-shim-02.so` | Adapter tested successfully with old X11. |
| `/tmp/applix-old-x11/XFree86-libraries-4.0.tgz` | Local copy of the historical X11 package. |

The source for rebuilding shim 02 is included in Appendix A. These instructions investigate an existing installation; they do not install FreeBSD, a desktop, or the original CD contents.

**Commands:**

```sh
uname -srn
command -v applix
file /usr/local/applixware/applix
cat /usr/local/bin/applix
ldd /usr/local/applixware/applix
```

**Selected output — local inspection, November 13, 2026:**

```text
FreeBSD mba 16.0-CURRENT
/usr/local/bin/applix
/usr/local/applixware/applix: ELF 32-bit LSB executable, Intel i386, version 1 (SYSV), dynamically linked, interpreter /usr/libexec/ld-elf.so.1, not stripped
```

**Selected output — launcher:**

```sh
export LD_32_PRELOAD=/usr/local/lib/libc_shim3.so
#export LD_32_PRELOAD=/usr/local/lib/libc3-shim-02.so
exec /usr/local/applixware/applix "$@"
```

The `#` makes the shim-02 line inactive. The installed command selects `libc_shim3.so`, a different adapter. The wrapper also kills a helper and deletes temporary files, so the diagnostic tests call the application directly.

**Selected output — loaded libraries:**

```text
	libX11.so.6 => /usr/lib32/libX11.so.6 (0x20041000)
	libc.so.3 => /usr/local/lib32/compat/libc.so.3 (0x2018f000)
	libxcb.so.1 => /usr/lib32/libxcb.so.1 (0x20228000)
	libthr.so.3 => /usr/lib32/libthr.so.3 (0x20254000)
```

`ldd` shows which library files the loader selects. Here, modern X11 brings in `libxcb` and the thread library `libthr`. Addresses in this document belong to the recorded runs and will vary.

## 2. Prepare a separate test copy

Save and close any running Applix session before comparing configurations: a new launch can reuse an old helper, invalidating the comparison. Do not kill unrelated desktop programs.

**Reproduction commands — run in `sh`, keeping this shell open:**

```sh
work=/tmp/applix-old-x11
mkdir -p "$work"
# Run this copy step once; use a fresh directory if runtime already exists.
test ! -e "$work/runtime" &&
    cp -R /usr/local/applixware "$work/runtime"

tar -xzf "$work/XFree86-libraries-4.0.tgz" \
    -C "$work" --strip-components 1 'lib/libX11.so*'

export AXHOME="$work/runtime"
export AXGFSDIR="$AXHOME/axdata/fontmetrics/gallium"
export AXLANG=english_us
export AX_TEMP_DIR="$work"
export DISPLAY=:0
cd "$work"
ulimit -c 0
```

Successful copying and extraction produce no terminal output. `ulimit` disables core-dump files for these tests. Use your actual display if it is not `:0`.

**Why the copy matters:** Applix writes settings under its application directory. A read-only CD or incomplete copy can stop startup even when the libraries work. This copy keeps those writes away from the installed application.

Define one launcher so the comparisons use the same settings:

```sh
run_words()
{
    env LD_32_LIBRARY_PATH="$1" LD_32_PRELOAD="$2" \
        "$AXHOME/applix" -wp
}
modern=/usr/local/lib32/compat:$AXHOME/axdata/axshlib
old=$work:$modern
shim=/usr/local/lib/libc3-shim-02.so
```

`-wp` selects Words. An empty second argument selects no preload. `LD_32_LIBRARY_PATH` controls where the 32-bit loader looks for libraries; `LD_32_PRELOAD` selects the adapter.

## 3. Follow the failures

### Modern X11 fails before the account lookup

**Reproduction command:**

```sh
run_words "$modern" "$shim"
```

**Verbatim output — recorded test:**

```text
Fatal error 'Cannot get _SC_NPROCESSORS_CONF' at line 534 in file /home/pkgbuild/worktrees/main/lib/libthr/thread/thr_init.c (errno = 22)
```

**Annotated reconstruction:** the thread library could not obtain the configured processor count. The process aborted. The printed source path identifies where the library was built; it is not a missing application file.

The installed adapter supplies a `sysconf` replacement, which answers system questions, and avoided this abort in an earlier comparison. That initially suggested a larger shim was needed. **Correction (see §4):** changing to old X11 opened Words with shim 02 alone. This failure does not establish that FreeBSD 16 itself requires the larger shim.

### Old X11 exposes the account failure

**Reproduction command:**

```sh
run_words "$old" ""
```

**Verbatim output — recorded test:**

```text
get user name: No such file or directory
```

The launcher exited with status 1. The stable finding is that it could not obtain the user's account name; the error text alone does not prove a file was missing.

To capture the kernel requests around a failed launch:

```sh
env LD_32_LIBRARY_PATH="$old" LD_32_PRELOAD= \
    truss -f -o "$work/no-shim.truss" "$AXHOME/applix" -wp
rg 'sigaction|sigprocmask|pwd.db|spwd.db|SIGSYS' "$work/no-shim.truss"
```

This is a reproduction command, not a claim that a new trace was captured for this revision. `truss` records requests to the operating system, not ordinary library function calls.

### Why the shim repairs signals as well

**Selected output — historical unshimmed trace on FreeBSD 15.1:**

```text
compat.freebsd32_sigaction() ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12
```

The historical investigation used the same `truss -f -o logfile program` method with its CD copy of Applix and old libraries selected. Unlike the current account-failure test, that setup stopped at an obsolete signal interface.

**Annotated reconstruction:** a **signal** is a notification sent to a program. The old library used a signal-handling interface unavailable in that tested kernel. Shim 02 translates the old signal data into the modern layout for `sigaction` and `sigprocmask`, then converts results back. It also ignores `SIGSYS` during initialization; ignoring the signal alone would not repair an unsupported operation.

### Why account lookup needs help

The earlier investigation traced account calls after repairing signals. On this local setup, old X11 already lets an unshimmed launch reach account lookup. To inspect those calls, use DTrace if its process probes are available:

**Reproduction commands — tracing requires suitable privileges:**

```sh
cat > "$work/account.d" <<'DTRACE'
#pragma D option quiet
pid$target::getpwuid:entry
{ printf("%s`%s(%u)\n", probemod, probefunc, (uint32_t)arg0); }
pid$target::getpwuid:return
{ printf("%s`%s returned 0x%lx\n", probemod, probefunc, (uintptr_t)arg1); }
pid$target::dbopen:entry
{ printf("%s`%s(\"%s\")\n", probemod, probefunc, copyinstr((uintptr_t)arg0)); }
DTRACE

env LD_32_LIBRARY_PATH="$old" \
    LD_32_PRELOAD= \
    dtrace -q -x nolibs -x evaltime=postinit \
    -s "$work/account.d" -c "$AXHOME/applix -wp"
```

This optional command leaves account lookup unrepaired. It is adapted to the local test paths; it was not executed during this revision. The historical capture below used a signal-only adapter on FreeBSD 15.1, so its UID and database path need not match a local run.

**Selected output — historical trace from `asiabsd`, not a fresh local run:**

```text
libc.so.3`getpwuid(0)
libc.so.3`dbopen("/etc/spwd.db")
libc.so.3`getpwuid returned 0x0
```

`getpwuid` looks up an account by numeric user ID. `0x0` means no account record was returned. These lines show the old reader opening the account database and failing to return the root account. They do not identify its exact internal failure.

**The fix:** shim 02 delegates account lookup to modern 32-bit `libc.so.7`. It includes the signal repairs too. Only this one adapter needs to be preloaded.

## 4. Select old X11 and shim 02

First check the historical library and the loader's choices.

**Commands:**

```sh
readelf -d "$work/libX11.so.6"
env LD_32_LIBRARY_PATH="$old" LD_32_PRELOAD="$shim" \
    ldd "$AXHOME/axdata/axmain"
nm -D "$shim" | rg ' (sigaction|sigprocmask|getpwuid|getpwnam)$'
```

**Selected output — old X11 metadata:**

```text
  0x0000000e (SONAME)   Library soname: [libX11.so.6]
```

The complete metadata listing contained no `NEEDED` entries: this X11 library does not request the modern thread-library chain.

**Selected output — loader check:**

```text
	libX11.so.6 => /tmp/applix-old-x11/libX11.so.6 (0x20045000)
	libg++.so.4 => /usr/local/lib32/compat/libg++.so.4 (0x20132000)
	libstdc++.so.2 => /usr/local/lib32/compat/libstdc++.so.2 (0x2016f000)
	libc.so.3 => /usr/local/lib32/compat/libc.so.3 (0x205be000)
	libc.so.7 => /usr/lib32/libc.so.7 (0x20657000)
```

These libraries must all resolve. A `not found` entry is a missing prerequisite, not something the shim fixes. This local `libc.so.3` is a link to `libc.so.4`; the historical FreeBSD 15.1 setup used an extracted FreeBSD 3.x library instead.

**Selected output — installed shim exports:**

```text
000019a0 T getpwnam
00001930 T getpwuid
000015e0 T sigaction
00001820 T sigprocmask
```

**Correction to §3's initial suspicion:** the following comparison used the same writable application copy. Old X11 removed the processor-count abort; shim 02 then crossed the account-lookup failure.

**Annotated reconstruction — results:**

| Configuration | Result |
|---|---|
| Modern X11 + shim 02 | Processor-count abort. |
| Old X11 + no shim | Account lookup failed. |
| Old X11 + shim 02 | Words opened. |

## 5. Verify Words, then run Presents

Ensure earlier test helpers have stopped before launching a new configuration. Inspect `ps ax -o pid,command` and stop only processes belonging to the temporary test copy; do not copy old process IDs from this document.

**Reproduction commands — launch and capture a trace:**

```sh
env LD_32_LIBRARY_PATH="$old" LD_32_PRELOAD="$shim" \
    truss -f -o "$work/stage02.truss" \
    "$AXHOME/applix" -wp > "$work/stage02.log" 2>&1 &
sleep 8
ps ax -o pid,ppid,command | rg '/tmp/applix-old-x11/runtime/'
cat "$work/stage02.log"
xwininfo -root -tree
```

**Selected output — recorded process list (leading display padding omitted):**

```text
22565 3928 /tmp/applix-old-x11/runtime/axdata/axnet /tmp/.axnetipc -fork
22566 3928 /tmp/applix-old-x11/runtime/axdata/axmain -helper 22563 4 7 -servicename axmain:wongk::0
22568 3928 /tmp/applix-old-x11/runtime/applix -wp
```

There was no captured error before the window appeared. After the test processes were deliberately stopped, the log contained `axmain: signal Terminated`; that was cleanup, not a startup failure.

Check the window and loaded files using the **current** window ID and `axmain` PID from your run:

```sh
# Recorded IDs are shown only to identify the saved evidence.
xwininfo -id 0xc000f2
procstat -v 22566
xwd -silent -id 0xc000f2 -out "$work/words.xwd"
```

**Selected output — recorded window check:**

```text
xwininfo: Window id: 0xc000f2 "/tmp/applix-old-x11/Words.aw"
  Map State: IsViewable
```

**Annotated reconstruction — recorded memory-map check:** `axmain` loaded `/tmp/applix-old-x11/libX11.so.6` and `/usr/local/lib/libc3-shim-02.so`. Neither `libthr` nor `libxcb` appeared in its memory map. The captured window was visually inspected: menus, toolbars, a blank page, and a status bar were visible.

**Key point:** a running process alone is not proof that a usable window opened. This run had both process evidence and a visible Words window.

For fonts, the working display included `/usr/local/share/fonts/misc`, `/usr/local/applixware/axfonts/all_pcf`, and `built-ins`. If using a separate test display, configure those paths there:

```sh
xset fp= /usr/local/share/fonts/misc,/usr/local/applixware/axfonts/all_pcf,built-ins
xset fp rehash
```

These are setup commands, not a new font test. They change the selected X display's font path.

Words was the debugging target. The same temporary environment can select Presents instead:

```sh
env LD_32_LIBRARY_PATH="$old" LD_32_PRELOAD="$shim" \
    "$AXHOME/applix" -presents
```

For the existing working installation, the command is:

```sh
applix -presents
```

**Observation — user report:** the completed work led to everything working, including Presents. No Presents terminal transcript or memory map was captured here. The directly recorded diagnostic result is Words with old X11 and shim 02. That establishes a sufficient startup combination, not the necessity of every function inside the shim or exhaustive testing of every feature.

## Appendix A. Complete shim source

The following source includes the two signal wrappers and both account wrappers. It is the complete source from the historical investigation, with explanatory comments added. The tested installed binary exports all four functions. A local source variant had `getpwnam` commented out, so it should not be assumed to reproduce that binary.

**Annotated reconstruction — source and build instructions, not recovered source from the installed binary:**

```sh
cat > "$work/libc3-shim-02.c" <<'SOURCE'
#include <sys/types.h>
#include <errno.h>
#include <pwd.h>
#include <dlfcn.h>
#include <string.h>

#ifndef RTLD_LOCAL
#define RTLD_LOCAL 0
#endif

static struct passwd *(*rl_getpwuid)(uid_t);
static struct passwd *(*rl_getpwnam)(const char *);

static void *libc7_h;
static int (*rl_sigaction)(int, const void *, void *);
static int (*rl_sigprocmask)(int, const void *, void *);

#define APPLIX_SIGSYS 12
#define APPLIX_SIG_IGN ((void (*)(int))1)

static void (*(*rl_signal)(int, void (*)(int)))(int);

/* The old program and modern library arrange signal data differently. */
struct old_sigaction {
    void *handler;
    unsigned int mask;
    int flags;
};

struct new_sigaction {
    void *handler;
    int flags;
    unsigned int mask[4];
};

static void
libc7_init(void)
{
    if (libc7_h)
        return;

    /* Find modern functions directly, avoiding a call back into this shim. */
    libc7_h = dlopen("libc.so.7", RTLD_LAZY | RTLD_LOCAL);
    if (!libc7_h)
        return;

    rl_sigaction = dlsym(libc7_h, "sigaction");
    rl_sigprocmask = dlsym(libc7_h, "sigprocmask");
    rl_signal = dlsym(libc7_h, "signal");
    rl_getpwuid = dlsym(libc7_h, "getpwuid");
    rl_getpwnam = dlsym(libc7_h, "getpwnam");

    if (rl_signal)
        rl_signal(APPLIX_SIGSYS, APPLIX_SIG_IGN);
}

int
sigaction(int sig, const struct old_sigaction *act, struct old_sigaction *oact)
{
    struct new_sigaction m_act;
    struct new_sigaction m_oact;
    struct new_sigaction *ap = NULL;
    struct new_sigaction *op = NULL;
    int ret;

    if (!libc7_h)
        libc7_init();

    if (act) {
        /* Move each old field into its modern position. */
        memset(&m_act, 0, sizeof(m_act));
        m_act.handler = act->handler;
        m_act.flags = act->flags;
        m_act.mask[0] = act->mask;
        ap = &m_act;
    }

    if (oact)
        op = &m_oact;

    ret = rl_sigaction ? rl_sigaction(sig, ap, op) : -1;
    if (ret == 0 && oact && op) {
        /* Return the previous action in the old program's format. */
        oact->handler = m_oact.handler;
        oact->flags = m_oact.flags;
        oact->mask = m_oact.mask[0];
    }

    return ret;
}

int
sigprocmask(int how, const unsigned int *set, unsigned int *oset)
{
    unsigned int m_set[4];
    unsigned int m_oset[4];
    void *sp = NULL;
    void *op = NULL;
    int ret;

    if (!libc7_h)
        libc7_init();

    memset(m_set, 0, sizeof(m_set));
    memset(m_oset, 0, sizeof(m_oset));

    if (set) {
        m_set[0] = *set;
        sp = m_set;
    }

    if (oset)
        op = m_oset;

    ret = rl_sigprocmask ? rl_sigprocmask(how, sp, op) : -1;
    if (ret == 0 && oset && op)
        *oset = m_oset[0];

    return ret;
}

struct passwd *
getpwuid(uid_t uid)
{
    if (!libc7_h)
        libc7_init();

    if (rl_getpwuid)
        return rl_getpwuid(uid);

    errno = ENOENT;
    return NULL;
}

struct passwd *
getpwnam(const char *name)
{
    if (!libc7_h)
        libc7_init();

    if (rl_getpwnam)
        return rl_getpwnam(name);

    errno = ENOENT;
    return NULL;
}
SOURCE

cc -m32 -shared -fPIC -Wall -Wextra \
    -o "$work/libc3-shim-02-rebuilt.so" "$work/libc3-shim-02.c"
nm -D "$work/libc3-shim-02-rebuilt.so" |
    awk '$2 == "T" && $3 ~ /^(sigaction|sigprocmask|getpwuid|getpwnam)$/ {print $2, $3}'
```

The separate output filename preserves the installed shim. During this revision, this source compiled without warnings. The symbol check removes addresses:

**Selected output — verified build, normalized by the displayed `awk` command:**

```text
T getpwnam
T getpwuid
T sigaction
T sigprocmask
```

This confirms the functions exist, not that every old caller can safely use every field of a modern account record. The historical startup check verified that Applix reads the account name, the first field in both old and modern records. The rebuilt file is not asserted to be byte-for-byte identical to the tested installed file.

## Appendix B. Saved evidence

The essential commands and results are included above. These files preserve the longer captures:

- [Configuration comparison](evidence/asiabsd27-old-x11-comparison.txt).
- [Test settings, checksums, and dependency listing](evidence/asiabsd27-old-x11-setup.txt).
- [Process list](evidence/asiabsd27-old-x11-processes.txt), [memory map](evidence/asiabsd27-old-x11-mappings.txt), and [window details](evidence/asiabsd27-old-x11-window.txt).
- [Words window capture](evidence/asiabsd27-old-x11-words.png).

No installed launcher or system library was replaced during the diagnostic tests. The temporary test processes were stopped afterward.
