From 865dbe841c282f20e04ec89d4693f3510d4107e9 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 26 Feb 2026 08:43:29 -0500 Subject: [PATCH] torch: skip self-copy during update in self-host installs --- torch/src/ops.mjs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/torch/src/ops.mjs b/torch/src/ops.mjs index 567e2a9b..24d52f30 100644 --- a/torch/src/ops.mjs +++ b/torch/src/ops.mjs @@ -148,6 +148,10 @@ function syncAppDirectories(torchDir, verb = 'Copied') { for (const dir of APP_DIRS) { const src = path.join(PKG_ROOT, dir); const dest = path.join(torchDir, dir); + if (path.resolve(src) === path.resolve(dest)) { + console.log(` Skipping ${dir}/ (source and destination are identical).`); + continue; + } if (fs.existsSync(src)) { copyDir(src, dest); console.log(` ${verb} ${dir}/`); @@ -167,6 +171,10 @@ function syncAppFiles(torchDir, installDir, verb = 'Copied') { for (const file of APP_FILES) { const src = path.join(PKG_ROOT, file); const dest = path.join(torchDir, file); + if (path.resolve(src) === path.resolve(dest)) { + console.log(` Skipping ${file} (source and destination are identical).`); + continue; + } if (fs.existsSync(src)) { if (installDir === '.' && file === 'package.json') { if (verb === 'Copied' && fs.existsSync(dest)) {