Files
mars-nwe/tests/salvage

Salvage smoke tests

This directory contains the shared mars_nwe NetWare salvage/deleted-entry tests. The backend is shared by NetWare 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.

Configuration covered by the tests

The active salvage configuration block is intentionally in a low nwserv.conf / nw.ini range:

51 1
52 .recycle .salvage
53 kv
54 0700 0700
55 0 0
56 -
57 -
58 -
59 -

Section meanings:

  • 51 enables/disables salvage.
  • 52 names the recycle payload repository and the .salvage metadata repository.
  • 53 is a compact Samba-vfs_recycle-style behaviour flag string:
    • k = keeptree,
    • v = versions,
    • t = touch,
    • m = touch_mtime.
  • 54 reserves directory/subdirectory modes for generated repositories.
  • 55 is minsize maxsize. Values may be raw bytes or case-insensitive kb, mb, or gb units, for example 55 1kb 100MB.
  • 56 is the exclude pattern list. Matching files are deleted directly.
  • 57 is the exclude_dir pattern list. Matching directories bypass salvage.
  • 58 is the noversions pattern list. Matching files are recycled, but old recycle names are replaced instead of getting Copy #x of NAME history.
  • 59 is reserved for cleanup/history policy.

Repository layout

With k/keeptree enabled, a deleted SYS:PUBLIC/PMDFLTS.INI owned by SUPERVISOR is expected to produce:

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

The .recycle tree contains deleted payload files. The .salvage tree contains one JSON sidecar per deleted object. There is no large per-directory index file.

The sidecar JSON must preserve mars_nwe server metadata needed for exact recover, including:

  • NetWare archive/fileinfo xattrs from nwarchive,
  • AFP metadata from nwatalk when present,
  • inherited rights mask and explicit trustee object/right pairs,
  • selected recycle/salvage relative paths.

finder_info_hex is serialized as a fixed 32-byte AFP FinderInfo block encoded as 64 hex characters. If mars_nwe has no FinderInfo xattr for the deleted object, the JSON stores the all-zero 32-byte FinderInfo value.

Samba-compatible version naming

With the v flag enabled, mars_nwe follows Samba vfs_recycle naming on collision:

SYS/.recycle/SUPERVISOR/PUBLIC/SLVGCHK.TXT
SYS/.recycle/SUPERVISOR/PUBLIC/Copy #1 of SLVGCHK.TXT
SYS/.recycle/SUPERVISOR/PUBLIC/Copy #2 of SLVGCHK.TXT

The .salvage sidecar uses the same selected payload name plus .json:

SYS/.salvage/SUPERVISOR/PUBLIC/SLVGCHK.TXT.json
SYS/.salvage/SUPERVISOR/PUBLIC/Copy #1 of SLVGCHK.TXT.json

If v is not enabled, or a file matches the noversions list, the old recycle payload/metadata is replaced instead of creating a Copy #x of ... history entry.

Layout smoke

salvage_layout_smoke.sh is a local filesystem-only contract test. It does not require a running mars_nwe server and does not use NCP.

./tests/salvage/salvage_layout_smoke.sh

It verifies the basic .recycle/.salvage directory contract and stale JSON detection.

NCP smoke suite

salvage_smoke_suite.sh is the single integration check for the server-side delete hook and Samba-compatible history behaviour. It uses ncp_delete_smoke, a small libncp client, to create and delete the same NetWare path twice through classic NetWare NCP file functions.

The suite appends all current integration checks into one report:

  • first delete: verifies normal .recycle payload and .salvage JSON capture,
  • second delete: verifies version naming with Copy #1 of NAME when option 53 contains the v flag,
  • NCP 0x2222 / 87 / 16: scans the same directory through the official ncpfs salvage scan API and verifies that both deleted names are returned.

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 payloads and JSON sidecars.

Example:

./tests/salvage/salvage_smoke_suite.sh \
  -S MARS -U SUPERVISOR -P secret \
  --path SYS:PUBLIC/SLVGCHK.TXT \
  --unix-path /var/mars_nwe/SYS/public/SLVGCHK.TXT \
  --volume-root /var/mars_nwe/SYS \
  --out /tmp/mars-salvage-report.txt

The script can run as a normal user. Best-effort pre-clean of stale test artifacts may warn when existing .recycle/.salvage files are owned by the server user or root; those warnings do not fail the smoke by themselves. For cleanest results, use a fresh test filename or run cleanup with the same Unix account that owns the mars_nwe volume files.

The old split scripts salvage_ncp_delete_smoke.sh and salvage_ncp_history_smoke.sh were replaced by this single suite so the salvage flow is exercised like the AFP smoke suite: one entry point, one report, and one summary. New salvage checks should be appended to this suite instead of growing separate top-level smoke scripts.

Still to implement

Runtime endpoint tests should be appended as the NCP salvage calls are implemented. The suite already covers the initial NCP 0x2222 / 87 / 16 scan endpoint after the delete/history phases have created salvageable entries.

  • optional NCP 0x2222 / 22 / 27 Scan Salvageable Files (old),
  • 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.