Comments (17)
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.
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.
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.
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):
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.
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.
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:
Thanks.
from unrarkit.
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.
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
It seems to be working with the Test Cases too (testExtractFiles_Unicode and testExtractFiles).
Thanks.
from unrarkit.
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.
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.
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.
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.
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.
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.
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.
I released your fix in v2.5, which is now out on CocoaPods
from unrarkit.
Thank you.
from unrarkit.
Related Issues (20)
- performOnDataInArchive needs too much RAM
- Building for iOS, but the linked and embedded framework 'UnrarKit.framework' HOT 1
- Not able to build XCFramework in Swift Package Manager with Mac Catalyst support HOT 6
- Does not support Mac Catalyst HOT 2
- Error resolving bookmark to RAR archive: Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist."
- Version 2.10 has unrar version that fails frequently "Archive has a corrupt header", but v2.11 branch not
- Including the Apple Privacy manifest file HOT 2
- Need a lazy way to iterate files HOT 6
- Allowing cancellation directly from extractFiles in middle of a file HOT 5
- Upgrade unrar library to v5.6.3 HOT 1
- Cannot decrease the verbosity of logging HOT 16
- Ability to check/test/repair corrupted header files HOT 6
- Allow ignoring of invalid CRCs in archive header
- Upgrade unrar library to v5.8.1
- Unhandled exception in +pathIsARAR:
- Ability to quick extract individual entry data without iterate through the entry list HOT 7
- Add support for Swift package manager HOT 7
- Realm and UnrarKit both have a list.hpp header HOT 10
- arm 64 support HOT 1
- About Unexpected end of archive and Corrupt header HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unrarkit.