fix: Fehlerbehandlung für I/O-Operationen während des Kopiervorgangs verbessert und Versionsnummer auf 1.0.17 erhöht

This commit is contained in:
2026-05-09 10:45:55 +02:00
parent 8bc3937956
commit 4557e8af89
2 changed files with 12 additions and 3 deletions

13
app.py
View File

@@ -638,6 +638,7 @@ def do_copy(src_dev, dst_dev, cfg):
dup_mode = cfg.get('duplicate_handling', 'skip') dup_mode = cfg.get('duplicate_handling', 'skip')
copied_pairs = [] # [(src, dst)] erfolgreich kopiert copied_pairs = [] # [(src, dst)] erfolgreich kopiert
skipped = 0 skipped = 0
io_errors = 0
# ── Phase 1: Kopieren ────────────────────────────────────────────── # ── Phase 1: Kopieren ──────────────────────────────────────────────
for i, f in enumerate(files): for i, f in enumerate(files):
@@ -672,10 +673,16 @@ def do_copy(src_dev, dst_dev, cfg):
try: try:
shutil.copy2(f, tmp_f) # Erst in Temp-Datei kopieren shutil.copy2(f, tmp_f) # Erst in Temp-Datei kopieren
os.replace(str(tmp_f), str(dst_f)) # Dann atomar umbenennen os.replace(str(tmp_f), str(dst_f)) # Dann atomar umbenennen
except Exception: except OSError as copy_err:
try: tmp_f.unlink(missing_ok=True) try: tmp_f.unlink(missing_ok=True)
except Exception: pass except Exception: pass
raise io_errors += 1
add_log(f'⚠ Fehler bei {f.name}: {copy_err}')
with copy_lock:
copy_state.update(done=i+1,
progress=int((i+1)/total*100) if total else 100,
current=str(f.name))
continue
copied_pairs.append((f, dst_f)) copied_pairs.append((f, dst_f))
with copy_lock: with copy_lock:
@@ -694,6 +701,8 @@ def do_copy(src_dev, dst_dev, cfg):
msg_parts = [f'{len(copied_pairs)} kopiert'] msg_parts = [f'{len(copied_pairs)} kopiert']
if skipped: if skipped:
msg_parts.append(f'{skipped} übersprungen') msg_parts.append(f'{skipped} übersprungen')
if io_errors:
msg_parts.append(f'{io_errors} Fehler (I/O)')
# ── Phase 2: Verifizieren ────────────────────────────────────────── # ── Phase 2: Verifizieren ──────────────────────────────────────────
verify_errors = 0 verify_errors = 0

View File

@@ -1 +1 @@
1.0.16 1.0.17