Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/textproto: ReadLineBytes() returns strange []byte #24642

Closed
Chipsterjulien opened this issue Apr 2, 2018 · 3 comments
Closed

net/textproto: ReadLineBytes() returns strange []byte #24642

Chipsterjulien opened this issue Apr 2, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Chipsterjulien
Copy link

What version of Go are you using (go version)?

1.10.1

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux on x86 (64 bits). Testing same code on android and it's ok

What did you do?

with 1.9.4, it works

With my bot on irc, sometimes, it reads some things with the code as follow:

reader := bufio.NewReader(bot.conn)
tp := textproto.NewReader(reader)
line, err = tp.ReadLineBytes()
…

I try with tp.ReadLine() to get a string but it's the same error.

Sometimes, i have this:

ircbot[1179]: [202B blob data]
ircbot[1179]: [125B blob data]

If possible, provide a recipe for reproducing the error.
yes and no. If my friend speaks yes, it's me, no:

As i said before, my code works with go-1.9.4

11:46:03.872 event ▶ DEBU 0a2 > :nheir!~nheir@died.re PRIVMSG #archlinux-fr :ça pourrait arriver en construisant une page web avec le bon titre par exemple
panic: runtime error: slice bounds out of range
ircbot[1049]: goroutine 11 [running]:
ircbot[1049]: main.(*Bot).searchToManyHL(0xc42009e5a0, 0xc4203c6020, 0xc42004fd78, 0xc420056600)
ircbot[1049]: /home/julien/ircbot/event.go:465 +0x970
ircbot[1049]: main.event(0xc42009e5a0, 0xc4200565a0, 0xc420056600, 0xc420056660, 0xc420060120, 0xc42004fef8)
ircbot[1049]: /home/julien/ircbot/event.go:153 +0xccd
ircbot[1049]: main.eventManagement(0xc42009e5a0, 0xc4200565a0, 0xc420056600, 0xc420056660, 0xc420060120)
ircbot[1049]: /home/julien/ircbot/readWriteEventProcess.go:45 +0x1c9
ircbot[1049]: created by main.main
ircbot[1049]: /home/julien/ircbot/app.go:52 +0x2ac
systemd[1]: ircbot.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
systemd[1]: ircbot.service: Failed with result 'exit-code'.

@agnivade
Copy link
Contributor

agnivade commented Apr 2, 2018

yes and no. If my friend speaks yes, it's me, no:

I'm sorry, what does that supposed to mean ?

Please post a self-contained working code which reproduces the issue.

Also, the error message that you have posted shows a panic on slice bounds out of range. But the issue you have reported is about ReadLineBytes() returning unexpected output. So which is the issue ? the panic or the unexpected output ?

Label suggestions - WaitingForInfo

@bcmills
Copy link
Contributor

bcmills commented Apr 2, 2018

It's not clear to me what issue you are reporting here. The panic trace you have posted is not a panic in the standard library, and we don't know what the ircbot output lines mean.

Do you believe that (*textproto.Reader).ReadLineBytes is returning something that is not, in fact, the next line from the underlying buffer? If so, it would help if you can provide an input that triggers that behavior. (You can log an arbitrary string in quoted Go syntax using the %q format specifier.)

As i said before, my code works with go-1.9.4

The only recent changes to the textproto package in 1.10 relate to leading whitespace (#22464, CC: @tombergan).

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 2, 2018
@bcmills bcmills added this to the Go1.11 milestone Apr 2, 2018
@bcmills bcmills changed the title textproto.readLineBytes() return strange []byte net/textproto: ReadLineBytes() returns strange []byte Apr 2, 2018
@Chipsterjulien
Copy link
Author

My bad, i found my big mistake. Sorry for the inconvenience

@golang golang locked and limited conversation to collaborators Apr 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants