fix(PROJ-66): Build-Fehler in printHelp() + -force überschreibt keine Hardlinks
BUG-1 (QA): Backticks in der restore-Hilfezeile schlossen das Raw-String- Literal von printHelp() vorzeitig, Build brach komplett. Backticks durch einfache Anführungszeichen ersetzt. BUG-2 (QA): -force bei restore scheiterte an bereits vorhandenen Hardlink-Zieldateien (os.Link: file exists) — für den Normalfall (Restore gegen einen PROJ-65-Tenant-Hardlink-Bestand) war -force damit funktionslos. copyTreePreservingHardlinks() entfernt jetzt eine vorhandene Zieldatei vor os.Link.
This commit is contained in:
@@ -202,6 +202,14 @@ func copyTreePreservingHardlinks(src, dst string) (linked, copied int, err error
|
||||
stat, ok := info.Sys().(*syscall.Stat_t)
|
||||
if ok {
|
||||
if existing, dup := seen[stat.Ino]; dup {
|
||||
// os.Link fails with EEXIST if target is already occupied — happens
|
||||
// on a -force restore where the destination isn't empty (BUG-2,
|
||||
// PROJ-66 QA). Remove any stale file first; harmless when the
|
||||
// destination is empty already (os.Remove on a non-existent path
|
||||
// is ignored below).
|
||||
if rmErr := os.Remove(target); rmErr != nil && !os.IsNotExist(rmErr) {
|
||||
return fmt.Errorf("hardlink %s -> %s: remove stale target: %w", existing, target, rmErr)
|
||||
}
|
||||
if err := os.Link(existing, target); err != nil {
|
||||
return fmt.Errorf("hardlink %s -> %s: %w", existing, target, err)
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ Commands:
|
||||
ocr-reprocess OCR für Anhänge nachholen (alle oder pro Mandant/Status)
|
||||
index-pending Ungeindexte Mails nachindexieren (cron-fähig, PROJ-58 batch_mode)
|
||||
backup Store, Keyfile, PostgreSQL und Config konsistent sichern (PROJ-66)
|
||||
restore Backup aus `archivmail backup` zurückspielen (PROJ-66)
|
||||
restore Backup aus 'archivmail backup' zurückspielen (PROJ-66)
|
||||
update Auf neueste Version aktualisieren (führt update.sh aus)
|
||||
status Healthcheck für DB, Manticore und Storage
|
||||
version Version anzeigen
|
||||
|
||||
Reference in New Issue
Block a user