mirror of
https://github.com/caprover/caprover
synced 2026-10-11 07:31:22 +00:00
fix: preserve dangling symlinks when copying backup data on macOS
cp -rp followed symlinks on BSD cp (macOS) because lowercase -r implies -L for historical compatibility, so a dangling certificate symlink under /captain/data raised ENOENT and aborted the whole backup copy. GNU cp (Linux) never followed symlinks here either way, so this only reproduced in local macOS dev/test runs, not CI. Switch to -RPp: -R is the portable recursive flag and -P makes the no-dereference behavior explicit on both cp implementations.
This commit is contained in:
1 parent
34d70b9013
commit
3cd7c4af29
1 file changed
+6
-1
@@ -43,9 +43,14 @@ export function copyCaptainDataForBackup(
|
||||
.then(
|
||||
() =>
|
||||
new Promise<void>((resolve, reject) => {
|
||||
// -R (not -r) with -P keeps dangling/symlinked certs
|
||||
// as symlinks on BSD cp (macOS) too. BSD's lowercase
|
||||
// -r implies following symlinks for compatibility,
|
||||
// which throws ENOENT on a broken link; GNU cp (Linux)
|
||||
// never followed them either way.
|
||||
execFile(
|
||||
'cp',
|
||||
['-rp', `${sourceDirectory}/.`, destinationDirectory],
|
||||
['-RPp', `${sourceDirectory}/.`, destinationDirectory],
|
||||
(error) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
|
||||
Reference in new issue
Block a user