From 4b5cbe0ab6617c7534c97081134fc82b354c91bd Mon Sep 17 00:00:00 2001 From: hoelee Date: Sun, 1 Nov 2026 14:27:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(install):=20`--dest`=20=E6=8C=87=E5=88=B0?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E6=97=B6=E6=8B=92=E7=BB=9D=E5=AE=89=E8=A3=85?= =?UTF-8?q?=EF=BC=8C=E5=88=AB=E6=8A=8A=E7=9B=AE=E5=BD=95=20rename=20?= =?UTF-8?q?=E8=BF=9B=E9=9A=94=E7=A6=BB=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 端到端实测(Z: 真共享盘,14:18)发现的:`--dest` 要的是文件路径,而第一版在两阶段提交的 "移走目标名上的东西" 一步不区分文件与目录 —— 传一个目录过去就把那个目录整块搬进了 `.transcode_trash`(0 字节、可回滚,但业主会看到目录凭空消失)。 现在:`live` 是目录 → 直接 `FAIL install refused: … exists and is a directory`, 目录与里面的文件一个都不动,源也留在原地(14:26 实测 keepme.txt 还在、源 4713 B 未动)。 同时把回执里的 `install.quarantine` 统一成文件名(原来 pre-publish 记文件名、post-install 记全路径)。 --- scripts/library_run.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/library_run.py b/scripts/library_run.py index 2e4d01f..c07bbe5 100644 --- a/scripts/library_run.py +++ b/scripts/library_run.py @@ -2047,6 +2047,13 @@ def process(src, args, dest=None, origin=None): quarantined = [] # [(trash path, original path)] targets = [live] if os.path.abspath(live) == os.path.abspath(src) else [] if not targets and os.path.exists(live): + # A DIRECTORY on the target name is not something to move aside: `--dest` takes a file + # path, so this is a mis-called run, and quietly renaming the owner's directory into the + # quarantine (measured 2026-11-01 14:18, an empty `out/`) hides the mistake instead of + # reporting it. + if os.path.isdir(live): + return ("FAIL install refused: %s exists and is a directory - `--dest` wants a file " + "path, nothing was replaced" % live), None targets = [live] # an older output already sitting on the target name for t in targets: if origin_used and os.path.abspath(t) == os.path.abspath(src): @@ -2118,7 +2125,8 @@ def process(src, args, dest=None, origin=None): "install": {"how": how, "tail": tail_msg, "cache_bypass": bool(bypassed and back_bypass), "quarantine": [os.path.basename(p) - for p, _ in quarantined] + retired}} + for p, _ in quarantined] + + [os.path.basename(p) for p in retired]}} finally: for p in (loc_src, loc_out):