Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
T
Tor
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,067
    • Issues 1,067
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 17
    • Merge Requests 17
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • The Tor Project
  • Core
  • Tor
  • Issues
  • #32178

Closed
Open
Opened Oct 22, 2019 by Roger Dingledine@armaReporter

Tor adds trailing space character to log events

First noticed in legacy/trac#32164 (moved), where Tor Browser's "view of Tor logs" has a bonus space at the end of every line.

I believe it's Tor adding the space. This super simple hack:

diff --git a/src/feature/control/control_events.c b/src/feature/control/control_events.c
index 82ea943999..5ddfffeee8 100644
--- a/src/feature/control/control_events.c
+++ b/src/feature/control/control_events.c
@@ -1328,6 +1328,7 @@ control_event_logmsg(int severity, log_domain_mask_t domain, const char *msg)
       default: s = "UnknownLogSeverity"; break;
     }
     ++disable_log_messages;
+    printf("Sending \"650 %s %s\"\n", s, b?b:msg);
     send_control_event(event,  "650 %s %s\r\n", s, b?b:msg);
     if (severity == LOG_ERR) {
       /* Force a flush, since we may be about to die horribly */

shows it:

Sending "650 INFO circuit_free_(): Circuit 0 (id: 4) has been freed. "

I believe it comes from this snippet in control_event_logmsg():

    if (strchr(msg, '\n')) {
      char *cp;
      b = tor_strdup(msg);
      for (cp = b; *cp; ++cp)
        if (*cp == '\r' || *cp == '\n')
          *cp = ' ';
    }

That is, we send in log lines that have \n in them, and the function helpfully turns the \n into a ' '.

Bug went into Tor 0.1.1.1-alpha in commit c2f6fe9b (way back in the days of the v0 control protocol).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.4.5.x-stable
Milestone
Tor: 0.4.5.x-stable (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: tpo/core/tor#32178