Re: [golang-dev] os.File.Seek() function panics on a pipe

294 views
Skip to first unread message

Dave Cheney

unread,
Oct 7, 2012, 8:09:28 PM10/7/12
to gvds...@gmail.com, golan...@googlegroups.com
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, <gvds...@gmail.com> 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

unread,
Oct 7, 2012, 8:11:38 PM10/7/12
to gvds...@gmail.com, golang-dev
It's the Stat call that's crashing the sandox, not Seek:

Brad Fitzpatrick

unread,
Oct 7, 2012, 8:35:57 PM10/7/12
to gvds...@gmail.com, golang-dev
Uh, I didn't even notice you were calling Size.  If you remove the method call, you can see the real error without crashing:

minux

unread,
Oct 8, 2012, 12:26:34 AM10/8/12
to Gerard, golan...@googlegroups.com

On Mon, Oct 8, 2012 at 11:15 AM, Gerard <gvds...@gmail.com> wrote:
Ok, I narrowed it down a bit:

Running this 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

unread,
Oct 8, 2012, 12:55:30 AM10/8/12
to golan...@googlegroups.com, Gerard
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)
Reply all
Reply to author
Forward
0 new messages