Files
mars-nwe/tests/salvage

Salvage smoke tests

This directory is reserved for NetWare salvage/deleted-entry coverage. The backend is intentionally shared by NCP salvage calls and the later AFP 0x13 Get Macintosh Info On Deleted Files adapter; AFP must not grow a parallel local deleted-file scanner.

The first executable coverage is layout-only. It records the repository contract before src/nwsalvage.c exists:

  • deleted file payloads live below the recycle repository,
  • per-object JSON metadata lives below the salvage repository,
  • JSON metadata preserves mars_nwe xattr-backed NetWare/AFP fields from nwarchive and nwatalk,
  • there is no large per-directory index file,
  • stale JSON metadata is detectable when the matching recycle payload is gone.

Default repository names come from the nwserv.conf/nw.ini template options:

48 1
49 .recycle .salvage

Expected layout for a deleted SYS:PUBLIC/PMDFLTS.INI owned by SUPERVISOR. The sidecar JSON must carry the server-only metadata needed for exact recover, including NetWare archive/fileinfo xattrs and AFP FinderInfo/entry-id/attribute xattrs:

SYS/.recycle/SUPERVISOR/PUBLIC/PMDFLTS.INI
SYS/.salvage/SUPERVISOR/PUBLIC/PMDFLTS.INI.json

Future runtime tests should add direct coverage for:

  • NCP 0x2222 / 22 / 27 Scan Salvageable Files (old),
  • NCP 0x2222 / 87 / 16 Scan Salvageable Files,
  • NCP 0x2222 / 87 / 17 Recover Salvageable File,
  • NCP 0x2222 / 87 / 18 Purge Salvageable File,
  • AFP 0x13 as a thin adapter over the shared salvage backend.

Trustee metadata

NetWare trustee rights are stored by mars_nwe in the trustee store, keyed by volume/dev/inode, rather than in the file payload itself. Salvage metadata therefore needs to preserve the inherited rights mask and the explicit trustee object/right pairs so recovery can recreate equivalent trustee records for the restored object.

NCP delete capture smoke

salvage_ncp_delete_smoke.sh is the integration check for the first real server-side salvage hook. It uses ncp_delete_smoke, a small libncp client, to create and delete a file through the classic NetWare NCP file functions:

  • 0x43 create file
  • 0x42 close file
  • 0x44 delete file

The script does not call local rm/unlink for the tested live path. Local filesystem access is used only after the NCP delete to inspect the expected recycle payload and JSON sidecar:

SYS/.recycle/SUPERVISOR/PUBLIC/SLVGCHK.TXT
SYS/.salvage/SUPERVISOR/PUBLIC/SLVGCHK.TXT.json

Example:

./tests/salvage/salvage_ncp_delete_smoke.sh \
  -S MARS -U SUPERVISOR -P secret \
  --path SYS:PUBLIC/SLVGCHK.TXT \
  --unix-path /var/mars_nwe/SYS/public/SLVGCHK.TXT

This check lives under tests/salvage rather than tests/afp because later salvage scan/recover/purge and versioning tests should share the same fixture. AFP can use the same backend later as an adapter for 0x13.