GithubHelp home page GithubHelp logo

extractFilesTo path bug about unrarkit HOT 17 CLOSED

abbeycode avatar abbeycode commented on August 19, 2024
extractFilesTo path bug

from unrarkit.

Comments (17)

abbeycode avatar abbeycode commented on August 19, 2024

Interesting... Now, the difference between the * and *W variants is using char vs. wchar, respectively. wchar is required for full unicode support. the unicharsFromString() method uses a specific UTF-32 (little endian) encoding, because the archives I had tested with used that encoding. May I ask what app created the test archive you linked? The spec does state that the file names should be in UTF-8. I'll have to update unicharsFromString() to more intelligently guess the encoding.

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

I used WinRAR 5.20 64bits for Windows (Portuguese Brazilian).

The file i provided in issue #19 also was created using this app and has the bug. Every rar that i tested (downloaded from the internet) had the bug.

Thanks for the quick reply.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

I added the linked archive to the Test Data folder (named Test Archive (RAR5).rar), and added a couple of unit tests against it, that both are passing. I did this in a new issue20 branch. Could you submit a pull request or comment on this issue detailing how to get these tests to break as you described?

testExtractFiles_RAR5
testListFilenames_RAR5

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

Sorry, i don't know very well how to use all the features of github.
I created a new repository here: https://github.com/SkiesOFF/UnrarKitBugTest

What i did:
-> Clean new Xcode 6.3.2 project
-> Pod install only with UnrarKit
-> In AppDelegate.m i created a easy test case, trying to extract a .rar file.
-> I print the files inside the folder before and after extraction.

The bug don't happens all the time. Expected logs (without bug):
screen shot 2015-06-22 at 4 19 45 pm

Logs when the bug happens:
screen shot 2015-06-22 at 4 21 25 pm

As you can see, there is a lot of trash in one of the rarWithoutPassword folder's name, It created 2 folders, one for each file inside the archive.

I needed to try 4+- times to catch the bug. I cleaned the simulator folder everytime.

Please, download the repository, i think it's just build and run.
Sorry for my bad english and thanks for your time.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

Have you tried a destination that's not inside your app bundle? You probably shouldn't be modifying that at runtime.

It'd be a lot easier to see this in a test case. I can help you with forking, if you haven't done it before. You basically click the "Fork" button, which makes a copy of the repo in your own account, and then you clone that, make your changes, and push.

This is GitHub's guide: https://guides.github.com/activities/forking/

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

I forked and tried but i couldn't reproduce the bug in your test unit. Maybe is the folder i'm using?

I updated my repository to use the /Documents with this code:

- (NSURL *)documentsDirectory {

    NSString *docsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
    NSURL* docsDirectory = [NSURL fileURLWithPath:docsPath isDirectory:YES];

    return docsDirectory;
}

The bug still happens sometimes:
screen shot 2015-06-22 at 10 05 39 pm

Thanks.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

I wonder if it's an iOS vs. Mac thing. The unit test runs on Mac. I'll take another look and let you know when I have something.

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

What would be the problem with the fix i suggested in the first comment? I thought it would mess with the unicode but i tested with this filenames and worked 100%:

Ⓣest Ⓐrchive.rar
rarWithoutPassword.rar
rarWithéçPassword.rar
rar★WitΨhéçPassword.rar
ⓉestУ ⒶrcдiЦe.rar

screen shot 2015-06-23 at 10 44 38 am

It seems to be working with the Test Cases too (testExtractFiles_Unicode and testExtractFiles).

Thanks.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

You're right, that doesn't break any existing unit tests, and it is fairly limited in scope. I do prefer to have a test case demonstrating a problem before adding a fix, though. I'm going to try to reproduce it a little longer, but if I'm unable, then I'll push out the fix without a test case.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

I added an iOS test bundle, and I'm still not seeing any problems. I updated the test to extract your test archive 500 times in a loop, and it passes. Can you verify whether the test works for you also?

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

Yes, i tested and it works too. I even pasted the code from my repository to your test case and still works. Everything is equal (folder, file, code), i simple can't make it work in any other project, even a new one.

I might create a "local fix" for me, unfortunately.

Thank you very much for your time, really appreciated the help.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

No problem, and I don't mind working with you to try to continue figuring out what's wrong - there's definitely something wrong somewhere. How are you installing UnrarKit in your new projects?

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

Open Xcode 6.3.2 -> Create a new Xcode Project -> IOS Single View Application -> Language: Objective-C, Devices: Universal. Project created.

Quit Xcode, go to project folder in terminal, -> pod init -> open -a Xcode Podfile. Edit:

https://github.com/SkiesOFF/UnrarKitBugTest/blob/master/UnrarKitBugTest/Podfile

Save, close, pod install, wait and open the project with .xcworkspace.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

Ah ha! I see it now. I'll take a look at the projects and see what's not configured the same. Looking at the output, though, it looks like it must be something in the text of "yohoho_ws.txt". That's the only one that ever ends up in the wrong directory.

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

So, stepping through the new text project in the debugger, I see that sometimes the result of unicharsFromString() gets padded with a bunch of 0xFFFD (�) characters. Those then don't get translated properly by dll.cpp's call to wcsncpy().

from unrarkit.

abbeycode avatar abbeycode commented on August 19, 2024

I released your fix in v2.5, which is now out on CocoaPods

from unrarkit.

andre-alves avatar andre-alves commented on August 19, 2024

Thank you.

from unrarkit.

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.