Skip to content

Upgrade zlib-ng to 2.2.1 - #105771

Merged
carlossanlop merged 5 commits into
dotnet:mainfrom
carlossanlop:UpgradeZlibNg
Sep 5, 2024
Merged

Upgrade zlib-ng to 2.2.1#105771
carlossanlop merged 5 commits into
dotnet:mainfrom
carlossanlop:UpgradeZlibNg

Conversation

@carlossanlop

Copy link
Copy Markdown
Contributor

Stable version 2.2.1 was released on July 2nd (a month ago).

Let's discuss if we want to include this update in .NET 9 or wait until after main points to .NET 10.

I am following the instructions we're adding for native dependency updates, to see if there's anything special that needs to be added: #105045 . For example: I decided to update the THIRD_PARTY_NOTICES.TXT to match the license exactly as it shows up in the 2.2.1 release commit, not on the develop branch, as we don't know if the license would change from one version to another. The contents are the same except for some line breaks.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

@stephentoub

Copy link
Copy Markdown
Member

Stable version 2.2.1 was released on July 2nd (a month ago).
Let's discuss if we want to include this update in .NET 9 or wait until after main points to .NET 10.

Am I understanding correctly that this is currently using 2.1.6 from January, such that by the time .NET 9 ships it'll be almost a year old?

Comment threadsrc/native/external/zlib-ng/PORTING.md
@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

Am I understanding correctly that this is currently using 2.1.6 from January, such that by the time .NET 9 ships it'll be almost a year old?

I started working on the zlib-ng migration before July 2nd, so the only other release available was a Release Candidate from June: https://github.com/zlib-ng/zlib-ng/releases/tag/2.2.0

In a meeting with @GrabYourPitchforks and @blowdart we also discussed that we would like to give external dependencies some time after they're released before we take them in. This is mainly why I'm asking we decide if we want to take this version, as it is only 1 month old.

@stephentoub

Copy link
Copy Markdown
Member

Thanks. Assuming we do all the relevant due diligence, I think we should take it. Ensuring we're as up-to-date as possible makes it easier to absorb servicing changes if any arise, we've still got months before the actual release, and the currently-used version will be almost a year out-of-date by the time we release.

@carlossanlop

carlossanlop commented Aug 22, 2024

Copy link
Copy Markdown
ContributorAuthor

@jkotas Here are my microbenchmark results testing with and without our custom allocator.

I used this commit for the custom allocator removal (not yet included in this PR): https://github.com/carlossanlop/runtime/commit/828545f382cbadf5793de31819057dfef42a8f4c

Summary:

  • We got slightly faster results when removing the custom allocator.
  • There were no cases where keeping the custom allocator was faster.
  • There was no change in the allocated and allocation ratio columns.

Deflate

Details
MethodJobToolchainlevelfileMeanErrorStdDevMedianMinMaxRatioRatioSDGen0AllocatedAlloc Ratio
CompressJob-YSVCTMwithout custom allocatorOptimalalice29.txt2,916.37 μs10.674 μs9.985 μs2,917.29 μs2,902.90 μs2,936.71 μs0.990.00-8.22 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalalice29.txt2,958.88 μs10.353 μs9.684 μs2,956.42 μs2,945.34 μs2,979.15 μs1.000.00-8.22 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalalice29.txt397.90 μs1.944 μs1.819 μs397.56 μs394.73 μs400.80 μs0.990.01-8.24 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalalice29.txt401.27 μs1.972 μs1.845 μs400.92 μs398.18 μs404.97 μs1.000.01-8.24 KB1.00
CompressJob-YSVCTMwithout custom allocatorOptimalsum547.96 μs3.124 μs2.770 μs547.46 μs544.48 μs552.78 μs0.940.01-8.22 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalsum584.37 μs7.197 μs6.732 μs580.71 μs579.14 μs596.69 μs1.000.02-8.22 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalsum68.81 μs1.987 μs2.288 μs68.35 μs66.29 μs75.05 μs0.990.050.28948.23 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalsum69.54 μs2.183 μs2.514 μs68.18 μs67.31 μs76.40 μs1.000.050.29218.23 KB1.00
CompressJob-YSVCTMwithout custom allocatorOptimalTestDocument.pdf2,709.84 μs10.633 μs8.879 μs2,711.08 μs2,696.98 μs2,721.65 μs1.000.00-8.22 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalTestDocument.pdf2,708.00 μs11.485 μs10.743 μs2,704.15 μs2,695.07 μs2,731.28 μs1.000.01-8.22 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalTestDocument.pdf326.64 μs0.937 μs0.877 μs326.57 μs325.29 μs328.28 μs1.010.00-8.24 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalTestDocument.pdf324.36 μs1.187 μs1.052 μs324.80 μs322.39 μs325.86 μs1.000.00-8.24 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestalice29.txt936.95 μs5.524 μs5.167 μs937.08 μs927.39 μs942.99 μs0.990.01-8.22 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestalice29.txt950.55 μs5.808 μs5.149 μs951.18 μs943.44 μs959.67 μs1.000.01-8.22 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestalice29.txt516.84 μs2.849 μs2.526 μs516.00 μs512.96 μs522.23 μs0.990.01-8.23 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestalice29.txt524.29 μs3.479 μs3.084 μs523.44 μs520.00 μs530.55 μs1.000.01-8.23 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestsum249.61 μs3.755 μs3.512 μs248.26 μs246.21 μs256.85 μs0.840.02-8.22 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestsum296.00 μs4.240 μs3.966 μs295.95 μs291.52 μs305.00 μs1.000.02-8.22 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestsum73.65 μs1.899 μs2.110 μs73.54 μs71.02 μs78.27 μs0.990.030.30648.23 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestsum74.44 μs1.419 μs1.578 μs73.50 μs72.90 μs78.32 μs1.000.030.31098.23 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestTestDocument.pdf1,265.54 μs8.724 μs8.161 μs1,262.51 μs1,257.22 μs1,279.14 μs1.000.01-8.22 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestTestDocument.pdf1,260.77 μs4.294 μs4.016 μs1,261.65 μs1,254.79 μs1,265.78 μs1.000.00-8.22 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestTestDocument.pdf331.76 μs0.602 μs0.503 μs331.74 μs330.69 μs332.72 μs1.000.00-8.24 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestTestDocument.pdf331.92 μs1.090 μs1.020 μs331.83 μs330.45 μs334.11 μs1.000.00-8.24 KB1.00

GZip

Details
MethodJobToolchainlevelfileMeanErrorStdDevMedianMinMaxRatioRatioSDGen0AllocatedAlloc Ratio
CompressJob-YSVCTMwithout custom allocatorOptimalalice29.txt3,092.28 μs13.702 μs12.817 μs3,094.35 μs3,073.88 μs3,115.65 μs0.990.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalalice29.txt3,128.58 μs11.340 μs10.607 μs3,125.02 μs3,115.51 μs3,148.59 μs1.000.00-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalalice29.txt410.38 μs1.472 μs1.229 μs409.97 μs408.31 μs412.65 μs0.990.01-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalalice29.txt414.42 μs2.382 μs2.111 μs413.56 μs412.50 μs418.60 μs1.000.01-8.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorOptimalsum566.11 μs4.941 μs4.622 μs566.43 μs558.69 μs574.46 μs0.940.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalsum601.07 μs6.776 μs6.338 μs597.76 μs595.39 μs613.79 μs1.000.01-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalsum71.56 μs2.287 μs2.634 μs71.31 μs67.92 μs76.47 μs1.000.040.29768.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalsum71.55 μs1.686 μs1.874 μs70.68 μs69.14 μs76.05 μs1.000.040.30198.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorOptimalTestDocument.pdf2,765.56 μs10.343 μs9.675 μs2,761.76 μs2,753.35 μs2,784.66 μs1.000.00-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalTestDocument.pdf2,771.55 μs8.792 μs7.794 μs2,768.61 μs2,762.94 μs2,790.14 μs1.000.00-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalTestDocument.pdf327.00 μs1.492 μs1.395 μs326.39 μs325.66 μs329.74 μs1.010.01-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalTestDocument.pdf325.29 μs1.331 μs1.180 μs325.12 μs323.64 μs327.57 μs1.000.00-8.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestalice29.txt960.43 μs5.991 μs5.311 μs959.00 μs953.37 μs973.42 μs0.980.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestalice29.txt979.64 μs4.138 μs3.668 μs979.38 μs973.99 μs985.97 μs1.000.01-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestalice29.txt515.84 μs1.202 μs1.066 μs515.74 μs514.03 μs518.05 μs0.980.00-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestalice29.txt524.58 μs1.857 μs1.646 μs524.29 μs522.27 μs527.00 μs1.000.00-8.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestsum255.82 μs4.019 μs3.760 μs254.10 μs251.98 μs263.95 μs0.830.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestsum307.60 μs3.991 μs3.538 μs306.85 μs302.65 μs314.94 μs1.000.02-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestsum74.22 μs1.843 μs2.122 μs74.46 μs71.24 μs79.21 μs0.980.040.30348.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestsum75.48 μs1.706 μs1.896 μs75.54 μs73.05 μs80.25 μs1.000.030.31578.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestTestDocument.pdf1,305.29 μs11.096 μs10.379 μs1,302.27 μs1,288.17 μs1,325.69 μs1.000.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestTestDocument.pdf1,302.80 μs7.118 μs6.659 μs1,303.62 μs1,292.07 μs1,313.95 μs1.000.01-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestTestDocument.pdf343.18 μs1.539 μs1.364 μs342.72 μs341.82 μs345.96 μs1.000.00-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestTestDocument.pdf343.73 μs0.933 μs0.827 μs343.83 μs342.50 μs344.85 μs1.000.00-8.27 KB1.00

ZLib

Details
MethodJobToolchainlevelfileMeanErrorStdDevMedianMinMaxRatioRatioSDGen0AllocatedAlloc Ratio
CompressJob-YSVCTMwithout custom allocatorOptimalalice29.txt2,928.34 μs10.285 μs8.588 μs2,929.18 μs2,911.31 μs2,939.21 μs0.980.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalalice29.txt2,973.98 μs18.508 μs16.406 μs2,970.56 μs2,956.85 μs3,012.49 μs1.000.01-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalalice29.txt400.41 μs3.422 μs3.201 μs399.63 μs395.94 μs405.79 μs0.990.01-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalalice29.txt403.53 μs1.656 μs1.383 μs403.31 μs401.36 μs405.98 μs1.000.00-8.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorOptimalsum547.31 μs3.959 μs3.509 μs546.54 μs543.55 μs554.45 μs0.940.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalsum584.32 μs7.886 μs7.377 μs581.57 μs577.08 μs599.15 μs1.000.02-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalsum67.84 μs1.431 μs1.591 μs67.81 μs65.40 μs71.22 μs0.950.040.28678.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalsum71.23 μs2.307 μs2.657 μs70.59 μs68.34 μs75.99 μs1.000.050.30058.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorOptimalTestDocument.pdf2,701.55 μs7.520 μs6.666 μs2,701.40 μs2,691.01 μs2,710.39 μs0.990.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorOptimalTestDocument.pdf2,721.83 μs17.107 μs15.165 μs2,721.79 μs2,697.94 μs2,752.02 μs1.000.01-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorOptimalTestDocument.pdf326.13 μs1.111 μs1.039 μs325.95 μs324.91 μs328.44 μs1.000.01-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorOptimalTestDocument.pdf326.13 μs1.512 μs1.415 μs325.50 μs324.57 μs328.34 μs1.000.01-8.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestalice29.txt937.92 μs4.171 μs3.483 μs938.67 μs931.24 μs943.66 μs0.990.00-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestalice29.txt949.18 μs3.242 μs3.033 μs948.89 μs944.80 μs953.85 μs1.000.00-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestalice29.txt527.59 μs2.235 μs1.982 μs528.21 μs524.48 μs531.75 μs1.010.00-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestalice29.txt524.94 μs1.634 μs1.364 μs524.89 μs523.08 μs527.70 μs1.000.00-8.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestsum248.28 μs2.749 μs2.437 μs248.53 μs243.77 μs253.27 μs0.840.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestsum295.76 μs4.967 μs4.646 μs295.12 μs290.55 μs304.22 μs1.000.02-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestsum74.43 μs2.116 μs2.436 μs74.61 μs70.16 μs79.64 μs0.990.040.30798.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestsum75.26 μs1.461 μs1.500 μs74.95 μs73.49 μs79.11 μs1.000.030.31578.27 KB1.00
CompressJob-YSVCTMwithout custom allocatorFastestTestDocument.pdf1,258.06 μs5.261 μs4.664 μs1,256.50 μs1,252.02 μs1,265.21 μs0.990.01-8.25 KB1.00
CompressJob-QGNCFRwith custom allocatorFastestTestDocument.pdf1,265.43 μs10.390 μs9.718 μs1,261.92 μs1,253.94 μs1,283.95 μs1.000.01-8.25 KB1.00
DecompressJob-YSVCTMwithout custom allocatorFastestTestDocument.pdf330.97 μs0.844 μs0.705 μs331.10 μs329.75 μs332.03 μs0.990.00-8.27 KB1.00
DecompressJob-QGNCFRwith custom allocatorFastestTestDocument.pdf333.58 μs0.714 μs0.596 μs333.73 μs332.58 μs334.52 μs1.000.00-8.27 KB1.00

@jkotas

Copy link
Copy Markdown
Member

There were no cases where keeping the custom allocator was faster.

The custom allocator is security mitigation. It is not meant to make things faster. It is expected to make things a bit slower, but the slowdown was assumed to be in the noise range (see #84604 for the perf numbers for when it was introduced).

It does not seem to be the case anymore for small payloads based on the results from the sum micro-benchmark.

@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

The custom allocator is security mitigation. It is not meant to make things faster.

I understand that. I was just mentioning the notable differences between the microbenchmark results, among which one of them happened to be a tiny speed improvement, which I agree it's negligible as it is not in the range outside noise.

So what is your opinion on formally including the removal of the custom allocator in this PR? I say we do it.

@jkotas

Copy link
Copy Markdown
Member

So what is your opinion on formally including the removal of the custom allocator in this PR? I say we do it.

Now that zlib-ng allocates one big memory block and manages the small memory allocations with that big block internally, the custom allocator does not provide most of the benefits that it was originally introduced for. I think it is fine to remove it.

@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

Ok great.

BTW Seems there are some tests failing. At first glance, it seems they expect a certain file size and it's not being met anymore. I need to investigate them.

@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

I see what the problem is. These are the test that are failing:

Test results
===========================================================================================================
Discovering: System.IO.Compression.Tests (method display = ClassAndMethod, method display options = None)
Discovered: System.IO.Compression.Tests (found 281 of 293 test cases)
Starting: System.IO.Compression.Tests (parallel test collections = on [16 threads], stop on fail = off)
System.IO.Compression.ZLibStreamUnitTests.ZLibCompressionLevel_SizeInOrder(testFile: "UncompressedTestFiles\\TestDocument.doc") [FAIL]
Expected 6773 <= 6768 for quality 6
Stack Trace:
C:\Users\calope\source\repos\runtime\src\libraries\Common\tests\System\IO\Compression\CompressionStreamUnitTestBase.cs(558,0): at System.IO.Compression.CompressionStreamUnitTestBase.CompressionLevel_SizeIn OrderBase(String testFile)
C:\Users\calope\source\repos\runtime\src\libraries\System.IO.Compression\tests\CompressionStreamUnitTests.ZLib.cs(158,0): at System.IO.Compression.ZLibStreamUnitTests.ZLibCompressionLevel_SizeInOrder(Strin g testFile)
--- End of stack trace from previous location ---
System.IO.Compression.DeflateStreamUnitTests.ZLibCompressionLevel_SizeInOrder(testFile: "UncompressedTestFiles\\TestDocument.doc") [FAIL]
Expected 6771 <= 6766 for quality 6
Stack Trace:
C:\Users\calope\source\repos\runtime\src\libraries\Common\tests\System\IO\Compression\CompressionStreamUnitTestBase.cs(558,0): at System.IO.Compression.CompressionStreamUnitTestBase.CompressionLevel_SizeIn OrderBase(String testFile)
C:\Users\calope\source\repos\runtime\src\libraries\System.IO.Compression\tests\CompressionStreamUnitTests.Deflate.cs(227,0): at System.IO.Compression.DeflateStreamUnitTests.ZLibCompressionLevel_SizeInOrder (String testFile)
--- End of stack trace from previous location ---
System.IO.Compression.GzipStreamUnitTests.ZLibCompressionLevel_SizeInOrder(testFile: "UncompressedTestFiles\\TestDocument.doc") [FAIL]
Expected 6781 <= 6776 for quality 6
Stack Trace:
C:\Users\calope\source\repos\runtime\src\libraries\Common\tests\System\IO\Compression\CompressionStreamUnitTestBase.cs(558,0): at System.IO.Compression.CompressionStreamUnitTestBase.CompressionLevel_SizeIn OrderBase(String testFile)
C:\Users\calope\source\repos\runtime\src\libraries\System.IO.Compression\tests\CompressionStreamUnitTests.Gzip.cs(449,0): at System.IO.Compression.GzipStreamUnitTests.ZLibCompressionLevel_SizeInOrder(Strin g testFile)
--- End of stack trace from previous location ---
Finished: System.IO.Compression.Tests
=== TEST EXECUTION SUMMARY ===
System.IO.Compression.Tests Total: 956, Errors: 0, Failed: 3, Skipped: 0, Time: 11.256s
----- end 2024-08-22 16:47:49.04 ----- exit code 1 ----------------------------------------------------------

In the recently added ZLibCompressionOptions from #105430, this test was modified to compare each compression level int value with the next one. Unfortunately, I don't think we should try to guarantee file sizes between one number and the immediate next one.

Before that modification, the test used to pass because it was comparing the hardcoded enum values CompressionLevel.NoCompression|Fastest|Optimal|Smallest, whose underlying compression level int values are far enough that we can actually guarantee that the file sizes will be as expected in the tests:
https://github.com/dotnet/runtime/blame/7a67973961ea1b997456ac76a7a5df0503354c5c/src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs#L475-L495

My proposed fix is to bring back the old test, and also add another test that only verifies the new ZLibCompressionOptions using the same underlying int values used by the old test.

@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

Small errata in my previous comment: The test was not modified, it was added. The previous test still exists and is passing. So I don't need to bring it back. It's only the new test that needs to be modified to ensure the comparisons are not done between two CompressionLevel int values that are too close to each other.

Comment threadsrc/native/external/zlib-ng-version.txt Outdated
Comment threadsrc/native/external/cgmanifest.json
@jkotas

Copy link
Copy Markdown
Member

Build breaks...

@jkotas

Copy link
Copy Markdown
Member

#105771 (comment) from my earlier feedback is still unresolved

Apply https://github.com/dotnet/runtime/pull/105433.patch No newline at end of file
Also apply:
- https://github.com/dotnet/runtime/commit/ecdb625035e0e3fb7c51e908713d96d2cb2080c8.patch or cherry-pick ecdb625035e0e3fb7c51e908713d96d2cb2080c8 directly.
- https://github.com/dotnet/runtime/pull/105771.patch No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This links to a full 1000's lines bug patch. I think this should only link to a single commit with the specific change, similar to the previous line.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hold on, I'll have to squash everything. Sigh.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should do it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry, this is still the wrong 1000's lines commit.

These commits should be only the zlib-ng delta vs. upstream.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, I want to do the right thing, but I am unsure how to get the correct delta that you expect.

The commit I used for the patch is the commit containing the squashed contents of this PR. That patch is showing a diff before and after updating zlib-ng (which does have a lot of changes since their last release). It's also excluding all the unnecessary files and folders, and also updating our informational json and txt files.

What am I missing?

Note: This comment thread is already old and pointing at the wrong patch (it's the patch of the PR itself). Are you looking at my most recent two commits?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am looking at the two most recent commits. 

Take a look at #102231 for a good way to make these types of updates. Could you please update this PR to be composed of these 3 commits:

Commit 1: Verbatim copy of the zlib-ng v2.2.1 sources (with the specific directories and files excluded)
Commit 2: Our patches in zlib-ng sources. You can either keep the patches as multiple commits or they can be squashed into a single commit. Either way is fine.
Commit 3: Changes outside src/native/external/zlib-ng, including links to commit(s) 2 in zlib-ng-version.txt

It is nice to merge these PRs as "merge" instead of "squash" so that it is easier to tell what happened.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done. If we merge this with a "merge-commit", the patch comment in zlib-ng-version.txt will be usable on the next zlib-ng update.

@jkotasjkotas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you!

@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

/ba-g all failures are pre-existing. The unknown one was a dead machine.

@carlossanlop
carlossanlop merged commit 468362f into dotnet:mainSep 5, 2024
@carlossanlop

Copy link
Copy Markdown
ContributorAuthor

/backport to release/9.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/10723125127

@github-actions

Copy link
Copy Markdown
Contributor

@carlossanlop backporting to release/9.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Update to zlib-ng 2.2.1, excluding the folders: - docs/ - test/ - arch/s390/self-hosted-builder/
Applying: Apply slide_hash and deflate patch with casts and asserts.
Applying: Remove custom allocator.
Using index info to reconstruct a base tree...
M	src/native/libs/System.IO.Compression.Native/CMakeLists.txt
M	src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c
Falling back to patching base and 3-way merge...
Removing src/native/libs/System.IO.Compression.Native/zlib_allocator_win.c
CONFLICT (modify/delete): src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c deleted in Remove custom allocator. and modified in HEAD. Version HEAD of src/native/libs/System.IO.Compression.Native/zlib_allocator_unix.c left in tree.
Removing src/native/libs/System.IO.Compression.Native/zlib_allocator.h
Auto-merging src/native/libs/System.IO.Compression.Native/CMakeLists.txt
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0003 Remove custom allocator.
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions

Copy link
Copy Markdown
Contributor

@carlossanlop an error occurred while backporting to release/9.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@carlossanlop@stephentoub@jkotas@GerardSmit