Files
magic/doc
Darryl L. MilesandClaude Opus 4.8 b2c35f8249 build: make the psfigures symlink source-safe and -j-safe
Out-of-tree, doc/latexfiles points a build-tree ../psfigures at the source
copy so latex/dvips resolve ../psfigures/*.ps.  The old
`test -e ../psfigures || ln -s ... ../psfigures` had two defects:

  * Under a parallel docs build two .ps jobs could both see ../psfigures
    absent and both run `ln -s`.  The second `ln -s DIR symlink-to-dir`
    nests the link *inside* the target, writing a stray
    doc/psfigures/psfigures INTO THE SOURCE TREE -- an out-of-tree build
    must never modify source.
  * (An order-only make prerequisite is not a fix here: VPATH makes make
    "find" ../psfigures in the source tree and skip creating the build link
    latex actually needs.)

Use a shell test (VPATH-immune) that is both idempotent and race/nest safe:
`test -d ../psfigures || ln -sfn ${MAGICSRC}/doc/psfigures ../psfigures`.
`test -d` is true in-tree (real source dir) and once the build symlink
exists; `ln -sfn` (force + no-dereference) replaces an existing symlink in
place instead of nesting inside it.

Verified in/out of tree under -j12: 28/28 docs, correct single-level build
symlink, source tree never touched (in-tree psfigures stays a real dir).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2026-07-26 14:54:11 -04:00
..