sandboxbox 3.0.25 → 3.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/utils/sandbox.js +27 -2
package/package.json
CHANGED
package/utils/sandbox.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdtempSync, rmSync, cpSync, existsSync, mkdirSync, writeFileSync, symlinkSync } from 'fs';
|
|
1
|
+
import { mkdtempSync, rmSync, cpSync, existsSync, mkdirSync, writeFileSync, symlinkSync, realpathSync } from 'fs';
|
|
2
2
|
import { tmpdir, homedir, platform } from 'os';
|
|
3
3
|
import { join, resolve } from 'path';
|
|
4
4
|
import { spawn, execSync } from 'child_process';
|
|
@@ -182,13 +182,38 @@ export function createSandbox(projectDir) {
|
|
|
182
182
|
const sandboxFile = join(sandboxClaudeDir, file);
|
|
183
183
|
|
|
184
184
|
if (existsSync(hostFile) && hostFile !== sandboxFile) {
|
|
185
|
+
// Additional check using real paths to detect symlink/bind mount issues
|
|
186
|
+
let shouldCopy = true;
|
|
187
|
+
try {
|
|
188
|
+
const hostRealPath = realpathSync(hostFile);
|
|
189
|
+
const sandboxRealPath = realpathSync(sandboxFile);
|
|
190
|
+
if (hostRealPath === sandboxRealPath) {
|
|
191
|
+
shouldCopy = false;
|
|
192
|
+
}
|
|
193
|
+
} catch (e) {
|
|
194
|
+
// If we can't resolve real paths, proceed with copy attempt
|
|
195
|
+
}
|
|
196
|
+
|
|
185
197
|
if (VERBOSE_OUTPUT) {
|
|
186
198
|
console.log(` Copying ${file}: ${hostFile} -> ${sandboxFile}`);
|
|
187
199
|
console.log(` Path comparison: hostFile === sandboxFile = ${hostFile === sandboxFile}`);
|
|
188
200
|
console.log(` Host file exists: ${existsSync(hostFile)}`);
|
|
189
201
|
console.log(` Sandbox file exists: ${existsSync(sandboxFile)}`);
|
|
202
|
+
try {
|
|
203
|
+
const hostRealPath = realpathSync(hostFile);
|
|
204
|
+
const sandboxRealPath = realpathSync(sandboxFile);
|
|
205
|
+
console.log(` Real paths: host=${hostRealPath}, sandbox=${sandboxRealPath}`);
|
|
206
|
+
console.log(` Real path comparison: hostRealPath === sandboxRealPath = ${hostRealPath === sandboxRealPath}`);
|
|
207
|
+
} catch (e) {
|
|
208
|
+
console.log(` Real path check failed: ${e.message}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (shouldCopy) {
|
|
213
|
+
cpSync(hostFile, sandboxFile);
|
|
214
|
+
} else if (VERBOSE_OUTPUT) {
|
|
215
|
+
console.log(` Skipping copy - real paths are the same`);
|
|
190
216
|
}
|
|
191
|
-
cpSync(hostFile, sandboxFile);
|
|
192
217
|
if (VERBOSE_OUTPUT && file === 'settings.json') {
|
|
193
218
|
// Show hook information for copied settings
|
|
194
219
|
// const settings = JSON.parse(readFileSync(hostFile, 'utf8'));
|