Failure while executing KTar::open while using KCompressionDevice as the device

Luiz Romário Santana Rios luizromario at gmail.com
Fri Nov 6 00:07:13 UTC 2015


2015-11-03 21:29 GMT-03:00 Aleix Pol <aleixpol at kde.org>:
> On Tue, Nov 3, 2015 at 3:58 AM, Luiz Romário Santana Rios
> <luizromario at gmail.com> wrote:
>> 2015-11-02 23:03 GMT-03:00 Aleix Pol <aleixpol at kde.org>:
>>> On Tue, Nov 3, 2015 at 3:00 AM, Luiz Romário Santana Rios
>>> <luizromario at gmail.com> wrote:
>>>> 2015-11-02 22:41 GMT-03:00 Aleix Pol <aleixpol at kde.org>:
>>>>> On Mon, Nov 2, 2015 at 6:53 PM, Luiz Romário Santana Rios
>>>>> <luizromario at gmail.com> wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I'm trying to decompress a XZ archive downloaded using
>>>>>> QNetworkAccessManager, so, according to the documents, I have to pass
>>>>>> the QNetworkReply pointer to a KCompressionDevice and, then, use it as
>>>>>> Ktar's device like this:
>>>>>>
>>>>>> https://gist.github.com/anonymous/b8fb686367f518a7dbb5
>>>>>>
>>>>>> The problem is that KTar::open() fails and returns false. The file I'm
>>>>>> trying to extract has the following structure more or less:
>>>>>> /root
>>>>>> /root/dir
>>>>>> /root/dir/file1
>>>>>> /root/dir/file2
>>>>>> ...
>>>>>>
>>>>>> So, as far as I've seen, the code runs normally when entering /root
>>>>>> and /root/dir, but, pretty high in the stack, at
>>>>>> KXzFilter::uncompress(), the call to lzma_code returns
>>>>>> LZMA_FORMAT_ERROR while trying to uncompress file1 (or file2, I'm not
>>>>>> sure). Here's the call stack:
>>>>>>
>>>>>> https://gist.github.com/anonymous/9ea380cfe48daadb5971
>>>>>>
>>>>>> Is this a bug? If it's a bug, how can I proceed to fix it?
>>>>>>
>>>>>> Thanks for the attention.
>>>>>
>>>>> Hi,
>>>>> A good first step would be coming up with a unit test like the ones
>>>>> you can find in karchive/autotests. If we have a reproducible test
>>>>> case it will be much faster to fix (for you and for us).
>>>>>
>>>>> Regards,
>>>>> Aleix
>>>>
>>>> I'll do that, but how do I host a local file so that it can be
>>>> "downloaded" from QNAM?
>>>>
>>>> --
>>>> Luiz Romário Santana Rios
>>>
>>> Using file:/// url scheme you can asynchronously read local files.
>>>
>>> Aleix
>>
>> I created a pretty simple archive:
>> /root
>> /root/dir
>> /root/dir/file1: contents of file1
>> /root/dir/file2: contents of file2
>> /root/dir/file3: contents of file3
>>
>> And then set up a simple test case:
>> Header: https://paste.kde.org/p8jkzlcgg/u5oiqj
>> Implementation: https://paste.kde.org/pt1yeawj1/t8sg8j
>>
>> Then this happens:
>> [...]
>> QWARN : KCompressionDeviceTest::testXzNetworkReplyDevice()
>> QIODevice::seek: Cannot call seek on a sequential device
>> QWARN : KCompressionDeviceTest::testXzNetworkReplyDevice()
>> QIODevice::seek: Cannot call seek on a sequential device
>> QWARN : KCompressionDeviceTest::testXzNetworkReplyDevice()
>> QIODevice::seek: Cannot call seek on a sequential device
>> QWARN : KCompressionDeviceTest::testXzNetworkReplyDevice()
>> QIODevice::seek: Cannot call seek on a sequential device
>> QWARN : KCompressionDeviceTest::testXzNetworkReplyDevice()
>> QIODevice::seek: Cannot call seek on a sequential device
>> QSYSTEM: KCompressionDeviceTest::testXzNetworkReplyDevice() Maximum
>> amount of warnings exceeded. Use -maxwarnings to override.
>>
>> Then the test freezes. I have to interrupt it so that it finishes. What's wrong?
>>
>> --
>> Luiz Romário Santana Rios
>
> If non-sequential is not supposed to work (which I don't know, I've
> never used KArchive like that), maybe you can consider doing a
> if(!device->isSequential()) download, then open.

I tried downloading the contents to a QBuffer and then passing it to
KCompressionDevice but it didn't work either.

>
> Also, can you provide the test in the shape of a patch to KArchive? :)

There you go: https://git.reviewboard.kde.org/r/125941/

>
> Aleix

P.S.: Resending because my previous message didn't reach the list.

-- 
Luiz Romário Santana Rios


More information about the Kde-frameworks-devel mailing list