Giter VIP home page Giter VIP logo

Comments (4)

psvajaz avatar psvajaz commented on June 12, 2024

How to use the - ssp switch, which was added in the 7-zip version of 20.02

from bit7z.

rikyoz avatar rikyoz commented on June 12, 2024

Hi!

When the comments in the file properties are too long, it can lead to compression errors.

Uhm, strange, I'll try to replicate the issue!
What are the specific error message and error code (e.g., code() and hresultCode()), if any?

How to use the - ssp switch, which was added in the 7-zip version of 20.02

I'll reply to this in the other issue you created (#184).

from bit7z.

psvajaz avatar psvajaz commented on June 12, 2024

After testing, it was found that this is an issue with the GHC library, and our project has found that there are some strange issues with the GHC library on the Windows platform. Now we have abandoned the option to enable the GHC library and compiled bit7z into a DLL using vs2019 for the main program to call

from bit7z.

rikyoz avatar rikyoz commented on June 12, 2024

Hi!
I'm sorry for not getting back to you sooner.

When the comments in the file properties are too long, it can lead to compression errors.
Using 7z can compress normally, but using bit7z for decompression will delete the file's note information.
After manually deleting the note information, bit7z can be used for compression without any errors.

I could not reproduce the problem, at least on develop.
I even added some unit tests to automatically check if the extraction/compression of commented files works. And it does work; I tested it on Windows 7, 10, and 11 with both MSVC 2015 and MSVC 2017.
For the tests, I used the exact same long JSON string for the comments.

TEMPLATE_TEST_CASE( "BitInputArchive: Extracting a file with a comment should preserve it",
"[bitinputarchive]", tstring, buffer_t, stream_t ) {
const TestDirectory testDir{ fs::path{ test_archives_dir } / "metadata" / "file_comment" };
TestType inputArchive{};
getInputArchive( "commented.7z", inputArchive );
BitArchiveReader info( test::sevenzip_lib(), inputArchive, BitFormat::SevenZip );
TempTestDirectory testOutDir{ "test_bitinputarchive" };
INFO( "Output directory: " << testOutDir )
REQUIRE_NOTHROW( info.extractTo( testOutDir ) );
const auto expectedFile = testOutDir.path() / "commented.jpg";
REQUIRE( fs::exists( expectedFile ) );
std::wstring comment = get_file_comment( expectedFile );
REQUIRE( comment == LR"({"data":{"pictureId":"738298be446d47f4b3933a4cc68ab6a2","appversion":"8.0.0",)"
LR"("stickerId":"","filterId":"","infoStickerId":"","imageEffectId":"",)"
LR"("playId":"","activityName":"","os":"android","product":"retouch"},)"
LR"("source_type":"douyin_beauty_me"})" );
REQUIRE( fs::remove( expectedFile ) );
}

TEST_CASE( "BitOutputArchive: Compressing a commented file should preserve the comment", "[bitoutputarchive]" ) {
const auto commentedFile = fs::path{ test_archives_dir } / "metadata" / "file_comment" / "commented.jpg";
BitArchiveWriter writer( test::sevenzip_lib(), BitFormat::SevenZip );
REQUIRE_NOTHROW( writer.addFile( path_to_tstring( commentedFile ) ) );
TempTestDirectory testOutDir{ "test_bitinputarchive" };
INFO( "Output directory: " << testOutDir );
const auto* const outputArchive = BIT7Z_STRING( "commented.7z" );
REQUIRE_NOTHROW( writer.compressTo( outputArchive ) );
REQUIRE( fs::exists( outputArchive ) );
BitArchiveReader info( test::sevenzip_lib(), outputArchive, BitFormat::SevenZip );
REQUIRE_NOTHROW( info.test() );
REQUIRE_NOTHROW( info.extractTo( testOutDir ) );
const auto expectedFile = testOutDir.path() / "commented.jpg";
REQUIRE( fs::exists( expectedFile ) );
std::wstring comment = get_file_comment( expectedFile );
REQUIRE( comment == LR"({"data":{"pictureId":"738298be446d47f4b3933a4cc68ab6a2","appversion":"8.0.0",)"
LR"("stickerId":"","filterId":"","infoStickerId":"","imageEffectId":"",)"
LR"("playId":"","activityName":"","os":"android","product":"retouch"},)"
LR"("source_type":"douyin_beauty_me"})" );
REQUIRE( fs::remove( expectedFile ) );
}

After testing, it was found that this is an issue with the GHC library, and our project has found that there are some strange issues with the GHC library on the Windows platform. Now we have abandoned the option to enable the GHC library and compiled bit7z into a DLL using vs2019 for the main program to call

This is really strange, as GHC is used only for paths and not much else!
Could you provide some more details on what bug did you find in the GHC library?
Thank you!

from bit7z.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.