#13086 closed defect (wontfix)
Hashed options are not portable
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | PollMacro |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
After upgrading trac-hacks.org to Trac 1.2 most of the poll results are not displayed. The following pages have polls:
- CollapsiblePlugin
- ExportImportXlsPlugin
- PerforcePlugin
- VisitCounterMacro
- PollMacro
- ScreenshotsPlugin
- DiscussionPlugin
- GuestbookPlugin
- TracTicketChangesetsPlugin
- TracUserSyncPlugin
- WikiTicketCalendarMacro
- LogViewerPlugin
- RequestaHack
Only RequestaHack shows any votes.
The poll options are hashed: pollmacro/trunk/tracpoll/tracpoll.py@16266:166#L146.
For the poll on the PollMacro page, the hashed values in the .poll
file are:
Cool
->13fc52bf
Crap
->73addc7c
On the trac-hacks.org server, I get:
>>> s1 = 'Cool' >>> '%08x' % abs(hash(s1)) '16f6c6ee13fc52bf' >>> s2 = 'Crap' >>> '%08x' % abs(hash(s2)) '16f6da078c522384'
I've gotten closer to reproducing the pair of values using the first 32bits of the hash, but only the first string matches:
>>> '%08x' % abs(hash(s1) & ((1<<32)-1)) '13fc52bf' >>> '%08x' % abs(hash(s2) & ((1<<32)-1)) '8c522384'
I assume the polls displayed correctly before upgrading to Trac 1.2, which involved creating a new virtualenv, but I get the same results from the old virtualenv so it's unclear to me what has changed.
I think we need to move to database storage of polls and results (comment:4:ticket:3495), but it would be nice to recover the results first.
Attachments (1)
Change History (10)
comment:2 Changed 8 years ago by
Another method is to use ctypes.c_int
:
>>> '%08x' % abs(ctypes.c_int(hash('Crap')).value) '73addc7c'
Changed 8 years ago by
Attachment: | t13086.diff added |
---|
comment:3 Changed 8 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Thanks! I patched with attachment:t13086.diff. Now we can move storage to the database (#3495).
comment:4 Changed 8 years ago by
BTW, ticket notification is not received when I added comment:1 and comment:2 to this ticket. Before upgrading to Trac 1.2, notifications was sent by [notification] always_notify_updater
enabled.
It seems TicketUpdaterSubscriber
and TicketPreviousUpdatersSubscriber
are missing in [notification-subscriber]
. The 2 subscribers are automatically added by source:/tags/trac-1.2/trac/upgrades/db40.py@:33-38#L17.
comment:5 follow-up: 7 Changed 8 years ago by
Thanks for spotting. .db40.bak
has:
[notification] always_notify_owner = true always_notify_reporter = true
The default for always_notify_updater
is True
, so the TicketUpdaterSubscriber
and TicketPreviousUpdatersSubscriber
should be present, but there is only:
[notification-subscriber] always_notify_cc = CarbonCopySubscriber always_notify_owner = TicketOwnerSubscriber always_notify_reporter = TicketReporterSubscriber
The TicketUpdaterSubscriber
and TicketPreviousUpdatersSubscriber
values are also missing from .db41.bak
, so it seems the upgrade step must have failed to add them.
I added them manually, so should be fixed now:
[notification-subscriber] always_notify_cc = CarbonCopySubscriber always_notify_owner = TicketOwnerSubscriber always_notify_reporter = TicketReporterSubscriber always_notify_updater = TicketUpdaterSubscriber always_notify_previous_updater = TicketPreviousUpdatersSubscriber
comment:7 follow-ups: 8 9 Changed 8 years ago by
Replying to Ryan J Ollos:
The default for
always_notify_updater
isTrue
, so theTicketUpdaterSubscriber
andTicketPreviousUpdatersSubscriber
should be present, but there is only:
This is a defect in db40.py. We should confirm default value of [notification] always_notify_*
options.
comment:8 Changed 8 years ago by
Replying to Jun Omae:
This is a defect in db40.py. We should confirm default value of
[notification] always_notify_*
options.
Thanks, I thought the issue sounded familiar. Looks to follow the same pattern as the issue that was fixed in [trac 14152].
comment:9 Changed 8 years ago by
Replying to Jun Omae:
Replying to Ryan J Ollos:
The default for
always_notify_updater
isTrue
, so theTicketUpdaterSubscriber
andTicketPreviousUpdatersSubscriber
should be present, but there is only:This is a defect in db40.py. We should confirm default value of
[notification] always_notify_*
options.
Issue reported in trac:#12700.
It seems old virtualenv is based on 32-bit python.
Use low 32-bit as signed integer to match stored hashed values in .poll file: