Opened 18 years ago

Closed 18 years ago

#1683 closed patch (fixed)

Scan can fail to add channels because new chanid collides with existing chanid

Reported by: Paul Milazzo <pgm0203@…> Owned by: danielk
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

When adding a channel, ChannelUtil::CreateChanID synthesizes a new chanid from the source and channel number, then tests the resulting chanid to ensure it does not collide with an existing chanid. If it does, ChannelUtil::CreateChanID chooses a new value one larger than the largest chanid currently assigned to the source in question.

Unfortunately, this second new chanid can (and on my system, does) itself collide with an existing chanid assigned to a higher-numbered source. As a result, the attempt to add the new channel fails without notification in the UI. An error message is, fortunately, written to the console.

The attached patch simply checks for the second collision and chooses a third value one larger than any current chanid. Another solution that would result in chanid values closer to the original would be to resolve the collisions using linear probing, but doing so could be much slower.

Attachments (1)

CreateChanID.patch (1.3 KB) - added by pgm0203@… 18 years ago.
Patch to avoid generating a new chanid that conflicts with an existing chanid

Download all attachments as: .zip

Change History (2)

Changed 18 years ago by pgm0203@…

Attachment: CreateChanID.patch added

Patch to avoid generating a new chanid that conflicts with an existing chanid

comment:1 Changed 18 years ago by danielk

Resolution: fixed
Status: newclosed

(In [9726]) Closes #1683. Adds another backup chanid creation method which should cope with collisions across sources.

This fixes a bug, but triggering this bug it is pretty difficult so I'm not backporting the fix to 0.19-fixes.

Note: See TracTickets for help on using tickets.