activescott / activescott/lessmsi

FilesToExtract Count Can Be Incorrect When Installer Contains Multiple CAB Files

未關閉
#119 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug good first issue help wanted
主要語言
C#
星號
1.8k
分支
188
PR 合併指標
30 天內沒有已合併 PR

描述

In the code a new ExtractionProgress object is created in Wixtracts.cs like this:
`progress = new ExtractionProgress(progressCallback, filesToExtract.Length);
`

However, this assumes it should set the progress bar maximum value to "filesToExtract.Length"

The problem with this is if the MSI contains multiple CAB files with varying amounts of files in each (some being duplicates), the total can be incorrect.

The correct total can actually be obtained later on in the same source code where it's parsing/merging the CAB files. Something similar to this would work:

```
public static void ExtractFiles(Path msi, string outputDir, MsiFile[] filesToExtract, AsyncCallback progressCallback)
{
'REMOVED ORIGINAL CODE FOR CLARITY
int realTotalFilesToExtract = 0;
try
{
foreach (MSCabinet decompressor in cabDecompressors)
{
realTotalFilesToExtract += decompressor.GetFiles().Count();
}
}
'...
'REMOVED FOLLOWING CODE FOR CLARITY
}

```
I'm not suggesting you use this exact code. Besides being pretty crude it's also obvious at this point in the code the ExtractionProgress object has already been created and the total number of files set (incorrectly). So this chunk of code would need to be reworked to fix this.

An example MSI with this issue is here:
[https://github.com/hexxellor/TemporaryJunk/raw/master/LessMSI%20Issue/Example%20MSI%20With%20Multiple%20CABs.zip](https://github.com/hexxellor/TemporaryJunk/raw/master/LessMSI%20Issue/Example%20MSI%20With%20Multiple%20CABs.zip
)

**_If you need this file, please grab it and keep a copy right away. I can't promise I'll be hosting it for more a month (after January 7th, 2019)._**

Thanks.

貢獻指南

開啟貢獻指南

研究方向

Start in `Wixtracts.cs` at `ExtractFiles`, where `ExtractionProgress` is currently initialized with `filesToExtract.Length`. Then read the later CAB parsing/merging logic in the same method (where `cabDecompressors` are built) to find where an accurate total can be derived. Adjust progress setup so the max reflects that total, possibly by moving initialization or updating it after merge. Mark done when the provided multi-CAB MSI sample runs and progress completion matches actual extracted-file count.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp
領域
tooling
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
49/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。