Intermittent RevZip Behavior

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

Intermittent RevZip Behavior

Post by ThatOneGuy » Mon Sep 23, 2013 6:38 am

Sometimes it works. More often it doesn't.

I frequently run into issues with adding/removing files from a zip archive. Errors are rarely thrown, "the result" is almost always empty, yet the commands often (or practically always in the case of revZipDeleteItem) have no effect whatsoever.

I already have verified that I am working in the correct directory at every moment and that the zip files are not open in the wrong modes before attempting to edit the files, but I can't get anything to delete and often it refuses to add things. Occasionally it will also add illegitimate files to the zip file, creating inaccessible content that just takes up space and cannot be removed. Of course, I almost never run into problems with extracting items, aside from the corrupt ones. I have that issue cleared up already though.

I'm beginning to think this is just one of the many bugs of the revZip feature of LiveCode, but I thought I'd ask anyway.

Does anyone have a clue why I could get no ziperr results and no effects either?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Intermittent RevZip Behavior

Post by Simon » Mon Sep 23, 2013 6:46 am

You left out the part where you store revZip.dll in a field!
RE: http://forums.runrev.com/phpBB2/viewtop ... =9&t=17192

Or if I ask. What happens when you copy revZip.dll along with your stack and do not extract it from a field?

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

Re: Intermittent RevZip Behavior

Post by ThatOneGuy » Mon Sep 23, 2013 6:06 pm

This is an unrelated issue on a related, but separate project. There is no stored DLL on this stack at all!

To answer your question, I tried storing the DLL in both a field and a variable and setting the externals to point to that, but it doesn't work.
There might be a way of doing that, but I haven't got it to work yet. When I do, you'll be one of the first to know.

The problem is that I can't get the revZip functions to work regularly even when in the IDE and when using the DLL itself. The delete functions sometimes (but rarely) work when I first start up the stack, then stop working entirely after just a little while. The add functions usually work just fine, aside from the occasional time when they don't do anything. The extract functions pretty much always work.

I'm just wondering why they stop working when there is no reason for it to happen and why no errors are thrown. Most of these problems have been encountered while in the IDE, but the same things happen outside as well, so I have no idea what is happening.
Last edited by ThatOneGuy on Mon Sep 23, 2013 6:54 pm, edited 1 time in total.

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

Re: Intermittent RevZip Behavior

Post by ThatOneGuy » Mon Sep 23, 2013 6:18 pm

Here's some code chunks:

Code: Select all

on deleteItems
   lock screen
   set the defaultfolder to DFolder // defaultfolder obtained at startup.
   revZipOpenArchive aArchive, "update"
   repeat while the hilitedlines of field "FileList" is not empty
      if line (item 1 of the hilitedlines of field "FileList") of field "filelist" is empty then exit repeat
      set the itemdel to comma 
      revZipDeleteItem aArchive, line (item 1 of the hilitedlines of field "FileList") of field "FileList"
      put the result
      set the hilitedlines of field "FileList" to item 2 to -1 of the hilitedlines of field "FileList"
   end repeat
   revzipclosearchive aArchive
   listzipcontents aArchive
   unlock screen
end deleteItems
This code almost never works. When the list is updated with "listzipcontents" it hasn't changed.
The result of the "put" command is always empty.

Code: Select all

on addItem
   local addLoc
   set the defaultfolder to DFolder
   lock screen
   revZipOpenArchive aArchive, "update"
   repeat while field "files" is not empty
      if field "Loc" is empty then put "" into addLoc
      else put field "loc" & "/" into addLoc
      set the itemdel to slash
      if there is a file (the first line of field "files") then revZipAddItemWithFile aArchive,  addloc & the last item of the first line of field "files", the first line of field "files"
      else addFolderToArchive aArchive, the first line of field "files", addloc
      put the result
      set the itemdel to comma
      delete the first line of field "files"
   end repeat
   revzipclosearchive aArchive
   listzipcontents aArchive
   send "mouseup" to btn "clear"
   unlock screen
end addItem
This one usually works, but occasionally doesn't. Again, the result is always empty.

pkocsis
Posts: 105
Joined: Sat Apr 15, 2006 7:20 am

Re: Intermittent RevZip Behavior

Post by pkocsis » Mon Sep 23, 2013 8:00 pm

Hello,

I've not had problems adding items, although most all of the archives I work with are newly created (by LC). I remember a long while back, I did experience trouble but it wasn't really intermittent. I ran into some archives (created outside of LC) that I couldn't manipulate (with LC)....found out that the internal compression method was "deflate64" vs "deflate". I'm not suggesting the behavior you're experiencing is related to that kind of deal, just wondering whether the troubles are with zips created by LC or are they existing zips created by something else? I don't delete items (in a zip) much at all so can't comment on that.

One thing you may want to do is to check "the result" from revZipCloseArchive. Possibly that could shed some light on what may be occurring.

Paul

ThatOneGuy
Posts: 77
Joined: Fri Jan 04, 2013 9:57 am

Re: Intermittent RevZip Behavior

Post by ThatOneGuy » Tue Sep 24, 2013 3:22 am

I might have found a workaround.

There seems to be a bug with revZip that causes problems when trying to remove the last item from a zip file. Once I try to remove the last item the file is suddenly broken and won't work as it should. I just stopped it from trying to delete the last item and deleted the zip file instead. That seems to have fixed things.

I'm not sure why it won't let me delete the last item without deleting the entire file since it is possible to have an empty zip file...

Post Reply