FAQ
Hello, when I am using the Seek function on a pipe, it panics. Shouldn't it
just generate an error? It also crashes in the sandbox when running
"pipe.go"

The code is: hello.go <http://play.golang.org/p/3VsQMI4Rx5> and pipe.go<http://play.golang.org/p/SGMeAHPxSi>

Building with "go build hello.go" and "go build pipe.go"
To execute type: ./hello | ./pipe

Debian 6.0 32 bit. Go 1.0.3

Gerard

Search Discussions

  • Dave Cheney at Oct 8, 2012 at 12:09 am
    Thank you for your detailed bug report, but you forgot the most
    important thing, the panic message.
    On Mon, Oct 8, 2012 at 10:14 AM, wrote:
    Hello, when I am using the Seek function on a pipe, it panics. Shouldn't it
    just generate an error? It also crashes in the sandbox when running
    "pipe.go"

    The code is: hello.go and pipe.go

    Building with "go build hello.go" and "go build pipe.go"
    To execute type: ./hello | ./pipe

    Debian 6.0 32 bit. Go 1.0.3

    Gerard
  • Brad Fitzpatrick at Oct 8, 2012 at 12:11 am
    It's the Stat call that's crashing the sandox, not Seek:

    http://play.golang.org/p/iPi2W77KxD


    On Sun, Oct 7, 2012 at 4:14 PM, wrote:

    Hello, when I am using the Seek function on a pipe, it panics. Shouldn't
    it just generate an error? It also crashes in the sandbox when running
    "pipe.go"

    The code is: hello.go <http://play.golang.org/p/3VsQMI4Rx5> and pipe.go<http://play.golang.org/p/SGMeAHPxSi>

    Building with "go build hello.go" and "go build pipe.go"
    To execute type: ./hello | ./pipe

    Debian 6.0 32 bit. Go 1.0.3

    Gerard
  • Brad Fitzpatrick at Oct 8, 2012 at 12:36 am
    Uh, I didn't even notice you were calling Size. If you remove the method
    call, you can see the real error without crashing:

    http://play.golang.org/p/3tKUjEqdla


    On Sun, Oct 7, 2012 at 5:11 PM, Brad Fitzpatrick wrote:

    It's the Stat call that's crashing the sandox, not Seek:

    http://play.golang.org/p/iPi2W77KxD


    On Sun, Oct 7, 2012 at 4:14 PM, wrote:

    Hello, when I am using the Seek function on a pipe, it panics. Shouldn't
    it just generate an error? It also crashes in the sandbox when running
    "pipe.go"

    The code is: hello.go <http://play.golang.org/p/3VsQMI4Rx5> and pipe.go<http://play.golang.org/p/SGMeAHPxSi>

    Building with "go build hello.go" and "go build pipe.go"
    To execute type: ./hello | ./pipe

    Debian 6.0 32 bit. Go 1.0.3

    Gerard
  • Gerard at Oct 8, 2012 at 4:13 am
    Ok, I updated pipe.go <http://play.golang.org/p/4I9PYraj1l> and now it only
    shows the hello world string and the error message. I used Stat().Size()
    only to show that it was actually a pipe (size=0).

    when executing: ./hello | ./pipe

    The output is:

    Hello, 世界

    %v(PANIC=runtime error: invalid memory address or nil pointer dereference)
  • Gerard at Oct 8, 2012 at 4:13 am
    Ok, I narrowed it down a bit:

    Running this <http://play.golang.org/p/NfQmImFu1T> code from the sandbox,
    you get the message:
    seek = 0, err = permission denied

    Running the same code as a standalone program the output is:
    seek = 0, err = %v(PANIC=runtime error: invalid memory address or nil
    pointer dereference)
  • Minux at Oct 8, 2012 at 4:26 am

    On Mon, Oct 8, 2012 at 11:15 AM, Gerard wrote:

    Ok, I narrowed it down a bit:

    Running this <http://play.golang.org/p/NfQmImFu1T> code from the sandbox,
    you get the message:
    seek = 0, err = permission denied
    Seems the sandbox is pretty strict, and only allows read and write to
    existing
    file descriptors.
    Running the same code as a standalone program the output is:
    seek = 0, err = %v(PANIC=runtime error: invalid memory address or nil
    pointer dereference)
    I can't reproduce this.
    On OS X/FreeBSD/Linux the output is:
    seek = 0, err = seek /dev/stdin: illegal seek

    What OS do you use?
  • Gerard at Oct 8, 2012 at 5:02 am

    Running the same code as a standalone program the output is:

    seek = 0, err = %v(PANIC=runtime error: invalid memory address or nil
    pointer dereference)
    I can't reproduce this.
    On OS X/FreeBSD/Linux the output is:
    seek = 0, err = seek /dev/stdin: illegal seek

    What OS do you use?
    Linux 32 bit Debian 6 (with vmware player)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedOct 8, '12 at 12:04a
activeOct 8, '12 at 5:02a
posts8
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase