Re: [sabayon] Re Firefox bookmarks loop



On Tue, 2006-10-03 at 09:52 +0200, Alexander Larsson wrote:
> On Sun, 2006-10-01 at 00:28 -0700, Travis Reitter wrote:
> > Everyone,
> > 
> > I've been working on bug #357021 for a few days now. So far, it's been
> > pretty challenging, but I think I'm getting pretty close. Right now I'm
> > kinda stuck - lib/sources/mozillasource.py generates the file
> > sabayon-bookmarks.html incorrectly. So I'm trying to take one of the
> > profile zips, decompress it, fix sabayon-bookmarks.html, then re-zip it
> > and put it in place.
> > 
> > However, this new version of sabayon-bookmarks.html from the modified
> > zip archive is not copied into ~/.mozilla/firefox, like it normally
> > would be, and it's not merged into
> > ~/.mozilla/firefox/*.default/bookmarks.html
> > 
> > How critical are the timestamps on all the files? Will Sabayon give up
> > if it sees conflicting times? (I've been setting the mtime of
> > sabayon-bookmarks.html back to what it was before the edit, anyhow).
> 
> I don't think we look at mtime at all in sabayon. Is mtime even stored
> in the zip file?
> 
> > The only other difference between the archives is that the ones I create
> > (with the "zip" command) are considered "Zip archive data, at least v1.0
> > to extract" by the "file" command (whereas the ones created by Sabayon
> > are "v2.0 to extract", and significantly larger).
> > 
> > Is there anything that I'm missing in the process?
> 
> I can't think of anything offhand, but I haven't looked at sabayon in a
> while. 
> 
> Also, I'd like to say I'm sorry for the lack of feedback on this issue.
> I'm a bit busy with other stuff, and not a lot of people are involved in
> sabayon development right now.

Cavet, I'm going on memory from work which was done close to 2 years ago
so I may very well have the details wrong which may have the potential
of confusing you more added to the fact the code has changed since then.

First of all your best bet is to enable the debug messages so you can
trace what is going on.

I don't believe modifying sabayon-bookmarks.html in the zip archive is
going to fix the problem because this file is going to always be merged
with the bookmarks file found in the destination. I think, but I'm not
positive the sabayon-bookmarks.html file is only ever unpacked to a
temporary staging area where it is then read by the code that merges it
with the bookmarks file in the destination.

The merge code (mozillasource.py line 1093) is not very complicated or
sophisticated, in essence it iterates over every entry in the bookmarks
file and if the entry is not in the destination then add it to the
destination bookmarks, or if it is in the destination but its mandatory
that it be replaced with the version from sabayon-bookmarks then replace
it.

    def merge(self, src, mandatory):
        def visit(entry, type, path, data):
            if type == mozilla_bookmarks.TYPE_FOLDER_END:
                return
            dst_entry = self.root.lookup_path(path)
            if not dst_entry or mandatory:
                self.root.add_path_entry(path, entry)

        src.root.traverse(visit)

It seems likely to me your duplicates might be introduced because if the
changes are mandatory then it adds the entry rather then replacing it. I
would put a debug logging statement where it calls add_path_entry to see
if this is where you're getting your duplicates. Another option is to
disable the mandatory flag and see if the problem goes away.
-- 
John Dennis <jdennis redhat com>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]