Edgewall Software
Modify

Opened 6 months ago

Last modified 6 months ago

#13766 assigned defect

Spaces in diff hunks incorrectly rendered

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.6.1
Component: rendering Version:
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I noticed that spaces in diff hunks are incorrectly rendered in #13764.

diff --git a/trac/util/daemon.py b/trac/util/daemon.py
index 3a2db5c27..984025825 100644
--- a/trac/util/daemon.py
+++ b/trac/util/daemon.py
@@ -53,7 +53,7 @@ def daemonize(pidfile=None, progname=None, stdin='/dev/null',
     # Perform first fork
     pid = os.fork()
     if pid > 0:
-        sys.exit(0) # exit first parent
+        os._exit(0)  # exit first parent

     # Decouple from parent environment
     os.chdir('/')
@@ -63,7 +63,7 @@ def daemonize(pidfile=None, progname=None, stdin='/dev/null',
     # Perform second fork
     pid = os.fork()
     if pid > 0:
-        sys.exit(0) # exit second parent
+        os._exit(0)  # exit second parent

     # The process is now daemonized, redirect standard file descriptors
     for stream in sys.stdout, sys.stderr:

Two spaces between os._exit(0) and # exit ... are rendered like single space (checked with Firefox, Google Chrome).

Attachments (1)

screenshot-diff-div.png (38.2 KB ) - added by Jun Omae 6 months ago.

Download all attachments as: .zip

Change History (2)

by Jun Omae, 6 months ago

Attachment: screenshot-diff-div.png added

comment:1 by Jun Omae, 6 months ago

Proposed changes in [8de52d27d/jomae.git]. We could use white-space: preserve-spaces and remove replacing spaces with  s.

Also, according to trac.mimeview.patch, similar rendering diff hunks exists in both trac.mimeview.patch and trac.versioncontrol.diff. I'll try to share/remove duplicated code.

    # FIXME: This function should probably share more code with the
    #        trac.versioncontrol.diff module

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Jun Omae.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Jun Omae 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.