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

syscall: Errno.Error() says [string too long] instead of actual error on Windows #8339

Closed
fraenkel opened this issue Jul 8, 2014 · 5 comments
Milestone

Comments

@fraenkel
Copy link
Contributor

@fraenkel fraenkel commented Jul 8, 2014

go version devel +1a9d124153b9 Sat Jul 05 08:48:46 2014 +0400 windows/386

If I run the following:
package main

import (
        "os"
        "strings"
)

func main() {
    longf := strings.Repeat("f", 240)
    
    _, e1 := os.Lstat("/tmp/" + longf)
    if e1 != nil {
        println(e1.Error())
    }
}

The result is [string too long]

If you shrink the repeat down eventually you will get
GetFileAttributesEx
/tmp/ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff:
The system cannot find the file specified.
@davecheney
Copy link
Contributor

@davecheney davecheney commented Jul 8, 2014

Comment 1:

The 'string too long' error is coming from println, if you print this error with
fmt.Println it will work.

Status changed to Invalid.

@dvyukov
Copy link
Member

@dvyukov dvyukov commented Jul 8, 2014

Comment 2:

This also affects panic.
http://play.golang.org/p/NjfZF0LppQ
says "panic: [string too long]" on tip.

Labels changed: added repo-main, release-go1.4.

Owner changed to @dvyukov.

Status changed to Accepted.

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 8, 2014

Comment 3:

CL https://golang.org/cl/110930043 mentions this issue.
@davecheney
Copy link
Contributor

@davecheney davecheney commented Jul 8, 2014

Comment 4:

I am very sorry, I should have given your error report more serious consideration.
@dvyukov
Copy link
Member

@dvyukov dvyukov commented Jul 8, 2014

Comment 5:

This issue was closed by revision 97c8b24.

Status changed to Fixed.

@fraenkel fraenkel added fixed labels Jul 8, 2014
@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Maxstring is not updated in the new string routines,
this makes runtime think that long strings are bogus.
Fixes golang#8339.

LGTM=crawshaw, iant
R=golang-codereviews, crawshaw, iant
CC=golang-codereviews, khr, rsc
https://golang.org/cl/110930043
wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Maxstring is not updated in the new string routines,
this makes runtime think that long strings are bogus.
Fixes golang#8339.

LGTM=crawshaw, iant
R=golang-codereviews, crawshaw, iant
CC=golang-codereviews, khr, rsc
https://golang.org/cl/110930043
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.