QArchive icon indicating copy to clipboard operation
QArchive copied to clipboard

Can't compress empty file

Open winsoft666 opened this issue 3 years ago • 3 comments

Can't compress empty file( file size is 0 byte).

Maybe need comment qarchivecompressor_p.cc#L618

winsoft666 avatar Dec 28 '21 11:12 winsoft666

I never saw the use case for compressing all empty files. Let me see.

antony-jr avatar Dec 28 '21 11:12 antony-jr

Right click desktop, create an new empty txt file, rename this file( just filename has a special meaning, file content is empty ), then compress this file to zip.

winsoft666 avatar Dec 28 '21 11:12 winsoft666

Yeah I get the idea. The thing is why do we make an archive only consist of empty files? Anyways I think we should handle this case too. I will look into this.

antony-jr avatar Dec 28 '21 12:12 antony-jr

The problem is not the fact it is not compressing, but that it hangs. The use case is when for what ever reason files have been created with zero size (can happen if they are transferred via network for example, or the process died during file creation - this is how we noticed it). I would be ok if QArchive throws an error in such a case - but not just hangs. And its a bug, not an enhancement. QArchive should not hang, in any situation, that is not expected behavior.

theLSB avatar Dec 09 '22 16:12 theLSB

Ok we can agree this is a bug. The fix should not be hard.. let me work on this.

antony-jr avatar Dec 09 '22 16:12 antony-jr

Please use the latest master, you can now compress empty files.

antony-jr avatar Dec 19 '22 19:12 antony-jr