Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#9464 closed defect (fixed)

[PATCH] trac-admin deploy - upgraded files contain leftovers in their end when new content is smaller.

Reported by: dnedelchev <dbn@…> Owned by: Christian Boos
Priority: high Milestone: 0.11.8
Component: admin/console Version: 0.12
Severity: trivial Keywords: deploy upgrade issue
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

It should be very trivial to be fixed.

I've upgraded from Trac 0.11 to Trac 0.12 and after: trac-admin /path/to/env deploy /deploy/path

Upgraded trac environments became inaccessible (Apache began returning error message to the browser requests).

I've compared the modified files with a recent backup and found that they were almost identical.
Affected were all files in the cgi-bin folder: trac.wsgi, trac.fcgi and trac.cgi.

There were just cosmetic changes and … also few bytes at the end originating from the pre-upgraded file version which of course are meaningless. After removing these characters all returned to normal.

The same happened both on WinXP and linux.

Attachments (0)

Change History (6)

comment:1 by Christian Boos, 14 years ago

Could you please try the following patch?

  • trac/env.py

    # hg export tip
    # HG changeset patch
    # User Christian Boos <cboos@neuf.fr>
    # Date 1277479660 -7200
    # Branch ticket:9464-0.12
    # Node ID d5c3274711f3e6484e4625d4b18863412cd6fe4a
    # Parent  f6580b49b56c59c0e65d5104bb46b147bcadbf00
    deploy: truncate files in case we overwrite
    
    diff --git a/trac/env.py b/trac/env.py
    a b class EnvironmentAdmin(Component):  
    731731            template = Chrome(self.env).load_template('deploy_trac.' + script,
    732732                                                      'text')
    733733            stream = template.generate(**data)
    734             out = os.fdopen(os.open(dest, os.O_CREAT | os.O_WRONLY), 'w')
     734            out = file(dest, 'w')
    735735            try:
    736736                stream.render('text', out=out)
    737737            finally:

comment:2 by dnedelchev <dbn@…>, 14 years ago

Summary: trac-admin deploy - upgraded files contain leftovers in their end when new content is smaller.[PATCH] trac-admin deploy - upgraded files contain leftovers in their end when new content is smaller.

Thanks for the prompt responce. I've just tried the patch. Yes, it works now. So ticket can be closed if patch is in the repository.

comment:3 by Remy Blank, 14 years ago

Milestone: 0.12.10.11.7.1
Resolution: fixed
Status: newclosed

The patch in comment:1 was applied in [9924].

comment:4 by Remy Blank, 14 years ago

Owner: set to Christian Boos

comment:5 by Christian Boos, 14 years ago

(I intended to close it after merge on trunk, which is still to do)

comment:6 by Remy Blank, 14 years ago

Ah, sorry. I just came across this ticket and thought I had seen it applied.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.