fix(shared): 前回の展開物を残したまま上書き展開しない - #2466
Merged
Merged
Conversation
unzip は targetPath を消さずに overwrite: 'a' で展開する。overwrite は
アーカイブに在るものを上書きするだけなので、旧バージョンにしか無かった
ファイルは残り続ける。
targetPath は同じパッケージ(Data/package/{id})・同じアーカイブ名で
再利用されるため、残骸は次のインストールに持ち込まれる。install() が
ファイル単位でコピーする通常経路は列挙されたものしか拾わないが、
isDirectory のエントリと isProgram(展開結果を丸ごとコピー)は
subtree ごと持っていくので、削除されたはずのファイルが AviUtl 側へ
再配置される。
展開前に消す。targetPath は resolveInside を通しているので、消す対象は
必ず基点の内側にある(この PR を #2465 の上に積んでいるのはそのため。
関門を通っていない状態で remove を足すと、書き込みより危険な操作を
無検証のパスに対して行うことになる)。
代償として、展開に失敗すると前回の展開物も失われる。アーカイブは
Data/{core,package}/archive に残っているのでやり直せる。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
内容
unzipはtargetPathを消さずにoverwrite: 'a'で展開します。overwriteはアーカイブに在るものを上書きするだけなので、旧バージョンにしか無かったファイルは残り続けます。targetPathは同じパッケージ(Data/package/{id})・同じアーカイブ名で再利用されるため、残骸は次のインストールに持ち込まれます。install()がファイル単位でコピーする通常経路は列挙されたものしか拾いませんが、isDirectoryのエントリ(実データに 55 件)isProgram(展開結果を丸ごとコピー)は subtree ごと持っていくので、作者が削除したファイルが AviUtl 側へ再配置されます。
なぜ #2465 の上に積むのか
この変更は
remove()を新しく足します。targetPathが関門を通っていない状態でこれを入れると、「書ける」より取り返しのつかない「消せる」を無検証のパスに対して行うことになります。#2465 で
targetPathがresolveInsideを通るようになるので、消す対象が必ず基点の内側にあることが保証されます。順序を逆にできません。代償
展開に失敗すると前回の展開物も失われます。アーカイブは
Data/{core,package}/archiveに残っているのでやり直せます。「壊れた新しい展開物」と「古い展開物が混ざった状態」なら前者のほうが扱いやすい、という判断です。
テスト
前回の展開物を残さない を追加しました。展開先に旧バージョンのファイル(ルート直下とサブディレクトリの両方)を置いてから展開し、消えていることを確認します。修正前は落ちます。
調査と文面の作成に Claude Code を使用しています。