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

Re: svnadmin hotcopy bug?

From: Neels J. Hofmeyr <neels_at_elego.de>
Date: Sat, 11 Oct 2008 02:36:44 +0200

eg wrote:
>> So how is the following log message?
>>
>> [[[
>>
>> Fix an issue with using the --archive-type=zip option whereby any
>> empty repository directories were not being zipped up.
>>
>> * tools/backup/hot-backup.py.in:
>> Make the script include any empty directories into the archive by
>> explicitly writing the directory names with a trailing backslash
>> during the directory walking phase. This has no effect on the content
>> for directories which already contain files.
>>
>> For references on this see:
>> http://hiparrot.wordpress.com/2005/12/05/writing-an-empty-directory-into-a-zipfile/
>>
>> or
>> http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-06/1486.html
>>
>>
>>
>> ]]]

>>
>> The patch is re-created against the trunk and re-tested (on Windows)
>> and included below.
>>
>
> Oops. Sorry I attached the whole script and not the patch.
> Here is the patch.

Lol, dude, it appears you haven't bothered to read the Hacking Guide. Before
this becomes any greater annoyance :P , let me see what I can do. It's a
one-liner after all, but it *does* take some level of investigation.

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).

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.

BTW, your patch is still far away from what is easy to process by a
committer. Please don't make our work difficult and actually read the
hacking guide before you consider posting another patch.
- Log message structure.
- Your mail had only "[PATCH]" in its subject.

So, here's the tweaked log message and my tweak of your patch.

[[[
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 (Main): Add empty directories to Zip
    files by explicitly writing the directory names with a trailing
    slash. Empty directories were previously omitted in Zip files.
]]]

I'll commit as soon as the date/time thing is reviewed/resolved.

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?).

~Neels

-- 
Neels Hofmeyr -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23458696  mobile: +49 177 2345869  fax: +49 30 23458695
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelsreg: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194

Received on 2008-10-11 02:37:40 CEST

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.