Edgewall Software
Modify

Opened 10 days ago

Last modified 10 days 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 10 days ago.

Download all attachments as: .zip

Change History (2)

by Jun Omae, 10 days ago

Attachment: screenshot-diff-div.png added

comment:1 by Jun Omae, 10 days 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
Note: See TracTickets for help on using tickets.