按推荐建议,继续执行

结论:新增 vendored LinuxCNC 源码同步验证脚本,去重 source-manifest,并在 native 验证前检查 vendor 与上游源文件字节一致,强化功能来源于 LinuxCNC 源程序的纪律。
This commit is contained in:
2026-06-07 17:06:02 +08:00
parent 18ee97b9b5
commit 4158a78760
4 changed files with 92 additions and 2 deletions

View File

@@ -467,6 +467,12 @@ Current verified progress:
`sincos.c`. These probes use the same `TP_FLAGS` as the standalone TP `sincos.c`. These probes use the same `TP_FLAGS` as the standalone TP
harness, including the existing `-fpermissive` boundary required by harness, including the existing `-fpermissive` boundary required by
upstream enum conversions in `tp.c`. upstream enum conversions in `tp.c`.
- `tools/verify_vendor_sync.sh` now validates the LinuxCNC source extraction
boundary before native probes run. It rejects duplicate manifest entries,
missing or extra vendored files, and byte-level drift between each manifest
file under `vendor/linuxcnc/` and the matching file under `../linuxcnc/`.
`tools/source-manifest.txt` was also de-duplicated so the manifest is a
single authoritative extraction list.
## Phase 4: Port INI Parsing Without Editing Upstream ## Phase 4: Port INI Parsing Without Editing Upstream

View File

@@ -9,6 +9,7 @@ GCODE_ERROR_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/gcode_errors"
CANON_ERROR_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/canon_errors" CANON_ERROR_FIXTURE_DIR="$ROOT_DIR/tests/fixtures/canon_errors"
NAMEDPARAM_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/namedparams.ini" NAMEDPARAM_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/namedparams.ini"
"$ROOT_DIR/tools/verify_vendor_sync.sh"
"$ROOT_DIR/tools/build_native_probes.sh" "$ROOT_DIR/tools/build_native_probes.sh"
check_exitcode() { check_exitcode() {

View File

@@ -115,5 +115,3 @@ src/emc/rs274ngc/interp_o_word.cc
src/emc/rs274ngc/interp_convert.cc src/emc/rs274ngc/interp_convert.cc
src/emc/rs274ngc/interp_cycles.cc src/emc/rs274ngc/interp_cycles.cc
src/emc/rs274ngc/interp_g7x.cc src/emc/rs274ngc/interp_g7x.cc
src/emc/rs274ngc/interp_check.cc
src/emc/rs274ngc/interp_execute.cc

View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
UPSTREAM_DIR="$ROOT_DIR/../linuxcnc"
VENDOR_DIR="$ROOT_DIR/vendor/linuxcnc"
MANIFEST_FILE="$ROOT_DIR/tools/source-manifest.txt"
if [[ ! -d "$UPSTREAM_DIR" ]]; then
echo "missing upstream directory: $UPSTREAM_DIR" >&2
exit 1
fi
if [[ ! -d "$VENDOR_DIR" ]]; then
echo "missing vendor directory: $VENDOR_DIR" >&2
exit 1
fi
if [[ ! -f "$MANIFEST_FILE" ]]; then
echo "missing manifest: $MANIFEST_FILE" >&2
exit 1
fi
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
MANIFEST_CLEAN="$TMP_DIR/manifest.clean"
MANIFEST_SORTED="$TMP_DIR/manifest.sorted"
VENDOR_SORTED="$TMP_DIR/vendor.sorted"
while IFS= read -r src_rel; do
[[ -z "$src_rel" ]] && continue
[[ "${src_rel:0:1}" == "#" ]] && continue
if [[ "$src_rel" = /* || "$src_rel" == *".."* ]]; then
echo "invalid manifest path: $src_rel" >&2
exit 1
fi
printf '%s\n' "$src_rel" >> "$MANIFEST_CLEAN"
done < "$MANIFEST_FILE"
if [[ ! -s "$MANIFEST_CLEAN" ]]; then
echo "empty manifest: $MANIFEST_FILE" >&2
exit 1
fi
sort "$MANIFEST_CLEAN" > "$MANIFEST_SORTED"
if duplicate_entries="$(uniq -d "$MANIFEST_SORTED")" && [[ -n "$duplicate_entries" ]]; then
echo "duplicate manifest entries:" >&2
printf '%s\n' "$duplicate_entries" >&2
exit 1
fi
find "$VENDOR_DIR" -type f | sed "s#^$VENDOR_DIR/##" | sort > "$VENDOR_SORTED"
if extra_vendor="$(comm -23 "$VENDOR_SORTED" "$MANIFEST_SORTED")" && [[ -n "$extra_vendor" ]]; then
echo "vendor files not listed in manifest:" >&2
printf '%s\n' "$extra_vendor" >&2
exit 1
fi
if missing_vendor="$(comm -13 "$VENDOR_SORTED" "$MANIFEST_SORTED")" && [[ -n "$missing_vendor" ]]; then
echo "manifest files missing from vendor:" >&2
printf '%s\n' "$missing_vendor" >&2
exit 1
fi
while IFS= read -r src_rel; do
upstream_file="$UPSTREAM_DIR/$src_rel"
vendor_file="$VENDOR_DIR/$src_rel"
if [[ ! -f "$upstream_file" ]]; then
echo "missing upstream file: $src_rel" >&2
exit 1
fi
if ! cmp -s "$upstream_file" "$vendor_file"; then
echo "vendor drift from upstream: $src_rel" >&2
exit 1
fi
done < "$MANIFEST_SORTED"
echo "vendor sync validation complete"