1. 20 Oct, 2016 1 commit
    • Joe Tsai's avatar
      archive/tar: fix parsePAXTime · ef8e85e8
      Joe Tsai authored
      Issues fixed:
      * Could not handle quantity of seconds greater than 1<<31 on
      32bit machines since strconv.ParseInt did not treat integers as 64b.
      * Did not handle negative timestamps properly if nanoseconds were used.
      Note that "-123.456" should result in a call to time.Unix(-123, -456000000).
      * Incorrectly allowed a '-' right after the '.' (e.g., -123.-456)
      * Did not detect invalid input after the truncation point (e.g., 123.123456789badbadbad).
      
      Note that negative timestamps are allowed by PAX, but are not guaranteed
      to be portable. See the relevant specification:
      <<<
      If pax encounters a file with a negative timestamp in copy or write mode,
      it can reject the file, substitute a non-negative timestamp, or generate
      a non-portable timestamp with a leading '-'.
      >>>
      
      Since the previous behavior already partially supported negative timestamps,
      we are bound by Go's compatibility rules to keep support for them.
      However, we should at least make sure we handle them properly.
      
      Change-Id: I5686997708bfb59110ea7981175427290be737d1
      Reviewed-on: https://go-review.googlesource.com/31441
      Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      ef8e85e8
  2. 19 Oct, 2016 35 commits
  3. 18 Oct, 2016 4 commits
    • Robert Griesemer's avatar
      spec: require 16 bit minimum exponent in constants rather than 32 · 8fbfdad2
      Robert Griesemer authored
      A 16bit binary exponent permits a constant range covering roughly the range
      from 7e-9865 to 7e9863 which is more than enough for any practical and
      hypothetical constant arithmetic.
      
      Furthermore, until recently cmd/compile could not handle very large exponents
      correctly anyway; i.e., the chance that any real programs (but for tests that
      explore corner cases) are affected are close to zero.
      
      Finally, restricting the minimum supported range significantly reduces the
      implementation complexity in an area that hardly matters in reality for new
      or alternative spec-compliant implementations that don't or cannot rely on
      pre-existing arbitratry precision arithmetic packages that support a 32bit
      exponent range.
      
      This is technically a language change but for the reasons mentioned above
      this is unlikely to affect any real programs, and certainly not programs
      compiled with the gc or gccgo compilers as they currently support up to
      32bit exponents.
      
      Fixes #13572.
      
      Change-Id: I970f919c57fc82c0175844364cf48ea335f17d39
      Reviewed-on: https://go-review.googlesource.com/17711Reviewed-by: 's avatarRob Pike <r@golang.org>
      Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      8fbfdad2
    • Matthew Dempsky's avatar
      cmd/compile: handle unsafe builtins like universal builtins · 3f2cb493
      Matthew Dempsky authored
      Reuse the same mechanisms for handling universal builtins like len to
      handle unsafe.Sizeof, etc. Allows us to drop package unsafe's export
      data, and simplifies some code.
      
      Updates #17508.
      
      Change-Id: I620e0617c24e57e8a2d7cccd0e2de34608779656
      Reviewed-on: https://go-review.googlesource.com/31433
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      3f2cb493
    • Mohit Agarwal's avatar
      math: speed up Gamma(+Inf) · 7eed848a
      Mohit Agarwal authored
      Add special case for Gamma(+∞) which speeds it up:
      
      benchmark            old ns/op     new ns/op     delta
      BenchmarkGamma-4     14.5          7.44          -48.69%
      
      The documentation for math.Gamma already specifies it as a special
      case:
      
              Gamma(+Inf) = +Inf
      
      The original C code that has been used as the reference implementation
      (as mentioned in the comments in gamma.go) also treats Gamma(+∞) as a
      special case:
      
      if( x == INFINITY )
              return(x);
      
      Change-Id: Idac36e19192b440475aec0796faa2d2c7f8abe0b
      Reviewed-on: https://go-review.googlesource.com/31370Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
      7eed848a
    • Brad Fitzpatrick's avatar
      net/http: update test to check Content-Length 0 Body more reliably · 97b04152
      Brad Fitzpatrick authored
      The way to send an explicitly-zero Content-Length is to set a nil Body.
      
      Fix this test to do that, rather than relying on type sniffing.
      
      Updates #17480
      Updates #17071
      
      Change-Id: I6a38e20f17013c88ec4ea69d73c507e4ed886947
      Reviewed-on: https://go-review.googlesource.com/31434
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarChris Broadfoot <cbro@golang.org>
      97b04152