Edgewall Software

Ticket #404 (closed defect: worksforme)

Opened 3 years ago

Last modified 3 years ago

Bitten mixes invalid data types

Reported by: Emmanuel Blot <manu.blot@…> Owned by: jhampton
Priority: critical Milestone:
Component: Build master Version: dev
Keywords: Cc: manu.blot@…
Operating System: BSD

Description

Although SQLite backend is able to cope with those type mistmaches, when Trac is using a PostgreSQL backend, Bitten prevents Trac from initialiazing properly.

  • bitten_rule id column is declared as TEXT, but sometimes used with INTEGER values
  • bitten_build rev column is declared as TEXT, but sometimes used with INTEGER values

Attaching a quick and dirty patch: works Ok, but it is likely that type conversion should occur in a more appropriate location.

  • bitten/model.py

     
    294294        platform = TargetPlatform(env, config=row[0], name=row[1]) 
    295295        platform.id = id 
    296296        cursor.execute("SELECT propname,pattern FROM bitten_rule " 
    297                        "WHERE id=%s ORDER BY orderno", (id,)) 
     297                       "WHERE id=%s ORDER BY orderno", (str(id),)) 
    298298        for propname, pattern in cursor: 
    299299            platform.rules.append((propname, pattern)) 
    300300        return platform 
     
    500500        if config is not None: 
    501501            where_clauses.append(("config=%s", config)) 
    502502        if rev is not None: 
    503             where_clauses.append(("rev=%s", rev)) 
     503            where_clauses.append(("rev=%s", str(rev))) 
    504504        if platform is not None: 
    505505            where_clauses.append(("platform=%s", platform)) 
    506506        if slave is not None: 

See  trac:ticket:8379 for a related ticket

Attachments

Change History

follow-up: ↓ 2   Changed 3 years ago by wbell

Is this not fixed by [639]-[641]?

in reply to: ↑ 1 ; follow-up: ↓ 7   Changed 3 years ago by Emmanuel Blot <manu.blot@…>

Replying to wbell:

Is this not fixed by [639]-[641]?

No, it only fixes one error out of three. I just found another one:

  • bitten/model.py

     
    223223            build.delete() 
    224224 
    225225        cursor = db.cursor() 
    226         cursor.execute("DELETE FROM bitten_rule WHERE id=%s", (self.id,)) 
     226        cursor.execute("DELETE FROM bitten_rule WHERE id=%s", (str(self.id),)) 
    227227        cursor.execute("DELETE FROM bitten_platform WHERE id=%s", (self.id,)) 
    228228        if handle_ta: 
    229229            db.commit() 
     
    294294        platform = TargetPlatform(env, config=row[0], name=row[1]) 
    295295        platform.id = id 
    296296        cursor.execute("SELECT propname,pattern FROM bitten_rule " 
    297                        "WHERE id=%s ORDER BY orderno", (id,)) 
     297                       "WHERE id=%s ORDER BY orderno", (str(id),)) 
    298298        for propname, pattern in cursor: 
    299299            platform.rules.append((propname, pattern)) 
    300300        return platform 
     
    500500        if config is not None: 
    501501            where_clauses.append(("config=%s", config)) 
    502502        if rev is not None: 
    503             where_clauses.append(("rev=%s", rev)) 
     503            where_clauses.append(("rev=%s", str(rev))) 
    504504        if platform is not None: 
    505505            where_clauses.append(("platform=%s", platform)) 
    506506        if slave is not None: 

  Changed 3 years ago by Emmanuel Blot <manu.blot@…>

  • cc manu.blot@… added

  Changed 3 years ago by osimons

  • owner changed from cmlenz to osimons

I'll look at it.

  Changed 3 years ago by osimons

See also attachment:ticket:318:bitten_model.patch Download that identifies many Postgres casting issues, and check that all identified issues are covered by [639:641] (#390) and the patch on this ticket.

  Changed 3 years ago by osimons

attachment:ticket:288:bitten-postgres8.3.patch Download is another patch covering type issues with Progress. Remember to review this patch as well to see if all issues are identified.

in reply to: ↑ 2   Changed 3 years ago by jhampton

  • status changed from new to assigned
  • owner changed from osimons to jhampton

Replying to Emmanuel Blot <manu.blot@…>:

Replying to wbell:

Is this not fixed by [639]-[641]?

No, it only fixes one error out of three. I just found another one:

Did you actually update your install? It looks as though the rev used for your diff was 629 (pre wbell's changes)

The id issues should be fixed now by [639] changing the schema to an integer column for id. The str(rev) change is added in [640] and [641]. I can't find any other location where rev would cause a problem. Additionally, I'm running the latest trunk with PG 8.3 and haven't had any type issues.

I'm going to close this ticket as worksforme in a few days if I don't hear anything back to the contrary

  Changed 3 years ago by eblot

  • status changed from assigned to closed
  • resolution set to worksforme

Yes it has been fixed, sorry.

  Changed 3 years ago by eblot

  • milestone 0.6 deleted

Add/Change #404 (Bitten mixes invalid data types)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.