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

Bug#354307: packages.qa.debian.org/m/mydsn.html has weird sorted news



On Sat, Jan 26, 2008 at 02:17:19PM +0100, Raphael Hertzog wrote:
> Note that this behaviour should be fixed. It happens that dak send several
> Accepted mails during the same second for example when the package gets
> out of NEW and when several upload happened while the package was sitting
> in NEW.
> 
> I remember neuro complaining about getting bounces on those cases. Jeroen
> never got around to fix that.

Ok, here is a proposed (yet untested) fix:

  zack@aquarium:/srv/debian/pts/www/bin$ svn diff common.py
  Index: common.py
  ===================================================================
  --- common.py   (revision 1821)
  +++ common.py   (working copy)
  @@ -18,8 +18,13 @@
       info = extract_info(msg)
   
       targetfile = "%s/%s.txt" % (dir, info['timestamp'])
  -    if os.path.isfile(targetfile):
  -        raise("Aiee, already such message %s" % targetfile)
  +    nonce = 0
  +    while os.path.isfile(targetfile):
  +        nonce += 1
  +        if nonce > 128: # eventually give up
  +            raise("can't find a free slot to save message, last stried was %s"\
  +                    % targetfile)
  +        targetfile = "%s/%s.%d.txt" % (dir, info['timestamp'], nonce)
       f = open(targetfile, "w")
       f.write(msg.as_string())
       f.close()

It assumes however that all mails received in the very same second are
to be kept, is it a correct assumption?

Also, it sort strangely news received in the very same second, here is
an example of what I mean (ipython session):

  In [18]: a=['1236.txt', '1235.txt', '1234.txt', '1235.1.txt', '1235.2.txt']
  In [19]: a.sort()
  In [20]: a.reverse()
  In [21]: a
  Out[21]: ['1236.txt', '1235.txt', '1235.2.txt', '1235.1.txt', '1234.txt']

This can be fixed in update_news.py using an ad-hoc sorting function,
but I don't think it's worth, after all those mail have all been
received in the very same second, whatever order would do IMO.

Let me know if you want me to commit this fix or not ...

Cheers.

-- 
Stefano Zacchiroli -*- PhD in Computer Science ............... now what?
zack@{upsilon.cc,cs.unibo.it,debian.org}  -<%>-  http://upsilon.cc/zack/
(15:56:48)  Zack: e la demo dema ?    /\    All one has to do is hit the
(15:57:15)  Bac: no, la demo scema    \/    right keys at the right time

Attachment: signature.asc
Description: Digital signature


Reply to: