Opened 4 months ago

Closed 4 months ago

#33531 closed defect (fixed)

surprise newline at the end of info-level cbt log

Reported by: arma Owned by:
Priority: Medium Milestone: Tor: 0.4.4.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: ahf Sponsor:

Description

In circuit_expire_building() there is an info-level log that logs a \n character:

         log_info(LD_CIRC,
-                 "Deciding to count the timeout for circuit %"PRIu32"\n",
+                 "Deciding to count the timeout for circuit %"PRIu32,
                  TO_ORIGIN_CIRCUIT(victim)->global_identifier);

the result is that I get strange blank lines in my log. I see them most obviously when I am doing

grep -v "\[info\]" /path/to/log-file|less

Child Tickets

Change History (7)

comment:1 Changed 4 months ago by arma

I did a bit of grepping to look for other cases. I don't think we can simply disallow \n in log strings, since there are plenty of multi-line log strings.

But then I got to thinking: maybe we can disallow log strings that *end* in \n?

I found a couple of those, like in fuzz_main():

    log_debug(LD_GENERAL, "Zero-Length-Input\n");
  log_debug(LD_GENERAL, "Result:\n%d\n", rv);

comment:2 Changed 4 months ago by arma

Summary: surprise newline in info-level cbt logsurprise newline at the end of info-level cbt log

comment:3 Changed 4 months ago by arma

I have made
https://github.com/torproject/tor/pull/1774
on github for the simple change.

comment:4 Changed 4 months ago by arma

(using my bug33531 branch which is now pushed to both github/armadev and torproject/user/arma)

comment:5 Changed 4 months ago by arma

Status: newneeds_review

github CI tells me that all checks pass

comment:6 Changed 4 months ago by ahf

Reviewer: ahf
Status: needs_reviewmerge_ready

Looks good.

comment:7 Changed 4 months ago by nickm

Milestone: Tor: 0.4.4.x-final
Resolution: fixed
Status: merge_readyclosed

merged to master.

Note: See TracTickets for help on using tickets.