Edgewall Software
Modify

Opened 17 years ago

Last modified 9 years ago

#5121 new defect

trac-admin tool stdout flush problem

Reported by: oren@… Owned by:
Priority: normal Milestone: unscheduled
Component: admin/console Version:
Severity: minor Keywords: autoflush flush
Cc: oren@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

"autoflush" is disabled, and thus when trying to hotcopy to a bad directory I get the following message (note the bad chronological order of the lines):

www-data@web:~$ trac-admin /data/trac/dirstat hotcopy /tmp/bla
Command failed: [Errno 17] File exists: '/tmp/bla'
Hotcopying /data/trac/dirstat to /tmp/bla ...

I'd suggest modifying the shebang line of trac-admin to "#!/usr/bin/python -u" in order to solve this. (attached as a micro-patch)

Attachments (1)

trac-admin.patch (346 bytes ) - added by oren@… 17 years ago.
Patch to address an autoflush issue

Download all attachments as: .zip

Change History (7)

by oren@…, 17 years ago

Attachment: trac-admin.patch added

Patch to address an autoflush issue

comment:1 by Christian Boos, 17 years ago

The shebang trick won't work on windows, so if the problem also shows up there (will try), the proposed fix is not OK.

comment:2 by Jeffrey Hulten <jeffh@…>, 17 years ago

You need someone to try and replicate this on Windows?

comment:3 by oren@…, 17 years ago

Yes please!

comment:4 by Remy Blank, 16 years ago

Milestone: 1.0
Severity: normalminor

Instead of using python -u on the shebang line, the following article has several other solutions:

http://stackoverflow.com/questions/107705/python-output-buffering

In particular, the following solutions make the most sense to me:

  • sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
  • Call sys.stdout.flush() after every write(). This could be done either in trac.admin.console.printout() or directly in trac.util.text.console_print().

comment:5 by Christian Boos, 14 years ago

Milestone: 1.0unscheduled

Milestone 1.0 deleted

comment:6 by Ryan J Ollos, 9 years ago

Owner: Christopher Lenz removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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