[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix hot-backup.py issue where zip archives do not backup empty directories

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Fri, 31 Oct 2008 00:12:10 +0200 (Jerusalem Standard Time)

Ping? Neels, you said planned to commit this one?

Daniel

eg wrote on Mon, 27 Oct 2008 at 23:16 -0700:
> Neels J. Hofmeyr wrote:
>
> >
> > I took a look at the python documentation, and it says this:
> >
> > [[[
> > [ZipFile.]writestr( zinfo_or_arcname, bytes)
> > Write the string bytes to the archive; zinfo_or_arcname is either the
> > file name it will be given in the archive, or a ZipInfo instance. If it's an
> > instance, at least the filename, date, and time must be given. If it's a
> > name, the date and time is set to the current date and time. The archive
> > must be opened with mode 'w' or 'a'.
> > ]]]
> >
> > Have you paid attention to the date and time stuff?
> >
> > When I test your patch on GNU/Linux, empty directories are added with a date
> > of 1980-01-01 00:00, which is not what the writestr() documentation says (if
> > I understand that correctly).
>
> hmmm... I must have mixed up reading the zinfo vs filename
> initialization logic in the help string. In the zinfo case, giving no
> time/date initializes it to 0 time which corresponds to the 1980-01-01
> date/time. Not what the function needs nor what we want.
>
> >
> > Could you please investigate? We're close to a commit, but the date/time
> > thing would be nice to clarify: Either fix it, or find a good reason why
> > it's not needed.
>
>
> I have fixed it in the attached patch.
>
>
> > I'll commit as soon as the date/time thing is reviewed/resolved.
>
> Thanks for your help and patience on this.
>
> >
> > For the record: while my `unzip' commandline tool successfully creates the
> > empty directories as above, the Gnome Archive Manager fails to list them (so
> > it's kind of a special case). I'd encourage using bz2 or gz instead. Most MS
> > Windows software supports these archive types, so there's really no need to
> > use zip archives in the first place (right?).
> >
>
> I did my testing with both 7-zip and winzip under WindowsXp and they
> both re-create the directories correctly too. I also did a quick test with
> InfoZip and that seemed to recreate the directory structure as well.
>
> I am not sure if it is quite true that "most" windows software
> supports bz2 or gz yet. However, it is true that it is becoming easier
> to find tools that do (like 7-zip or the recently released Winzip 12).
>
> Personally, I use bz2 for our production environment backup.
>
> The revised patch is attached and here is the revised patch log message:
>
> [[[
> In the hot-backup.py script, also add empty directories to a Zip backup
> (when using option --archive-type=zip). Implements this suggestion:
> http://mail.python.org/pipermail/python-list/2004-June/266067.html
>
> Patch by: eg <egoots_at_gmail.com>
>
> * tools/backup/hot-backup.py.in (add_to_zip): Add empty directories to
> Zip files by explicitly writing the directory names with a trailing
> slash. Empty directories were previously omitted in Zip files.
> ]]]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-30 23:12:37 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.