Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-31 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-

Comment (by teor):

 We think that the fastest way to resolve this issue is to create unit
 tests in C that check that the Rust and C string, enum, and integer
 constants are equal.

 In the longer term, we should think about generating C and Rust constant
 source files from a single source of truth.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-24 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-

Comment (by teor):

 > Also, duplicating strings costs RAM, so de-duplicating will save us RAM.

 This isn't true: we only compile the C module or the Rust module, not
 both.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-24 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-

Comment (by teor):

 If calling into C for strings costs too much CPU, we can generate the
 files at build time.
 Or, if we access the string many times, we can take a copy in Rust.

 Also, duplicating strings costs RAM, so de-duplicating will save us RAM.

 I'm not sure if either effect will be significant in practice.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-24 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-

Comment (by chelseakomlo):

 Replying to [comment:6 teor]:
 > I think we should have one copy of strings (and other constants) across
 Rust and C, as much as possible.
 >
 > Let's make it a coding standard, and see how we go adopting it in
 protover?

 Yes I think that is a good idea. On one hand, removing duplication as much
 as possible is valuable. On the other hand, we'll need FFI calls for every
 static string (and we should look at the cost with string copying when
 moving across language boundaries). Either way it is messy but having a
 standard way of doing things will be helpful to managing
 complexity/possible bugs.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-24 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-

Comment (by teor):

 I think we should have one copy of strings (and other constants) across
 Rust and C, as much as possible.

 Let's make it a coding standard, and see how we go adopting it in
 protover?

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-24 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-

Comment (by chelseakomlo):

 I agree about having a single source of truth for cases like static
 strings- if we do this for protover, we should make it a coding standard
 for all new Rust functionality? It would be nice to standardize our
 approach.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

Re: [tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-05-24 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
-+-
 Reporter:  teor |  Owner:  (none)
 Type:  defect   | Status:  new
 Priority:  Medium   |  Milestone:  Tor:
 |  unspecified
Component:  Core Tor/Tor |Version:  Tor:
 |  0.3.2.1-alpha
 Severity:  Normal   | Resolution:
 Keywords:  rust, memory-leaks, technical-debt,  |  Actual Points:
  034-triage-20180328, 034-removed-20180328  |
Parent ID:   | Points:  1
 Reviewer:   |Sponsor:
-+-
Changes (by chelseakomlo):

 * cc: chelseakomlo (added)


--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs

[tor-bugs] #25156 [Core Tor/Tor]: Stop duplicating static strings between Rust and C

2018-02-05 Thread Tor Bug Tracker & Wiki
#25156: Stop duplicating static strings between Rust and C
--+
 Reporter:  teor  |  Owner:  (none)
 Type:  defect| Status:  new
 Priority:  Medium|  Milestone:  Tor: 0.3.4.x-final
Component:  Core  |Version:  Tor: 0.3.2.1-alpha
  Tor/Tor |
 Severity:  Normal|   Keywords:  rust, memory-leaks, technical-debt
Actual Points:|  Parent ID:
   Points:  1 |   Reviewer:
  Sponsor:|
--+
 In the protover crate, we list all supported protocol versions.
 And then we do it again in C.

 This makes it likely that they will get out of sync.
 Also, passing static strings from Rust to C is error-prone (#25127).

 Let's put all the static strings in C, and access them from Rust.
 Yes, that might mean we pass them from C to Rust and back to C again. Oh
 well.

--
Ticket URL: 
Tor Bug Tracker & Wiki 
The Tor Project: anonymity online
___
tor-bugs mailing list
tor-bugs@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs