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

Test didn't passed on Windows 7 #1899

Closed
gopherbot opened this issue May 30, 2011 · 33 comments
Closed

Test didn't passed on Windows 7 #1899

gopherbot opened this issue May 30, 2011 · 33 comments

Comments

@gopherbot
Copy link

by chanwit:

There's a small glitch that let the test to stop after successfully compile on Windows 7.

The patch is attached.

Thank you.
@gopherbot
Copy link
Author

Comment 1 by chanwit:

Attaching patch.

Attachments:

  1. go_1899.patch (526 bytes)

@rsc
Copy link
Contributor

rsc commented May 30, 2011

Comment 2:

I thought we decided that string didn't matter.

Owner changed to @alexbrainman.

Status changed to Accepted.

@peterGo
Copy link
Contributor

peterGo commented May 31, 2011

Comment 3:

Now we can compile and run the program. On Unix, this would be the result:
    $ 6g file.go                       # compile file package
    $ 6g helloworld3.go                # compile main package
    $ 6l -o helloworld3 helloworld3.6  # link - no need to mention "file"
    $ helloworld3
    hello, world
    can't open file; err=No such file or directory
    $
An I/O Package, A Tutorial for the Go Programming Language.
http://golang.org/doc/go_tutorial.html
As the carefully crafted tutorial clearly states: "On Unix, this would be the result:
... 'can't open file; err=No such file or directory'." On Windows, the result is
different: 'can't open file; err=The system cannot find the path specified.'
It's unreasonable to expect the text of error messages in Unix and Windows to be the
same, especially when they use native OS error numbers and message text.
Don't apply the attached patch!

@alexbrainman
Copy link
Member

Comment 4:

This is a dup of https://golang.org/issue/1834.
Russ, what do you think we should do to fix this "problem"?
Alex

@gopherbot
Copy link
Author

Comment 5 by chanwit:

Hi
Should we use a table for error numbers to checking this, rather than using error
messages? Although error numbers are native to each OS, but it's more predictable than
messages.
(The locale setting affected this as seen in issue #1834.)
Cheers
Chanwit

@rsc
Copy link
Contributor

rsc commented May 31, 2011

Comment 6:

Alex,
You said in the other issue
"The error doesn't stop the build, the build completes successfully."
But this issue claims it breaks the build, so I'm confused.
Russ

@peterGo
Copy link
Contributor

peterGo commented May 31, 2011

Comment 7:

The error is logged. The build does not fail.

@gopherbot
Copy link
Author

Comment 8 by chanwit:

Hi all,
So what I see is the log showing in the end of the build.
However, I didn't see the final "ALL TESTS PASSED" message.
Attached to support claim.

Attachments:

  1. go1899_screen.png (48775 bytes)

@alexbrainman
Copy link
Member

Comment 9:

My build log is different (see attached). I don't know what your problem is. Perhaps if
you show full bash trace, we will see which command fails:
cd $GOROOT/doc/progs
bash -x run
Thank you.
Alex

Attachments:

  1. alex.jpg (61022 bytes)

@peterGo
Copy link
Contributor

peterGo commented Jun 1, 2011

Comment 10:

You have a "cannot create 8.out.exe" message, which terminates the build. Neither Alex
nor I get that message. Why can't you create 8.out.exe?
After running thse commands, what is the output for hg id.
  $ cd $GOROOT
  $ hg id

@gopherbot
Copy link
Author

Comment 11 by chanwit:

I suspect the same after seeing Alex's screen, but do not know what's preventing this
yet.
$ hg id
5bf3a11773f7+ tip

@gopherbot
Copy link
Author

Comment 12 by chanwit:

I found that the "cannot create 8.out.exe" message occurred randomly (~20%). It's
clearly not the Go problem, but something else.

@alexbrainman
Copy link
Member

Comment 13:

If you try and run script in question in "show every command as it executes" mode
cd $GOROOT/doc/progs
bash -x run
we might be able to see which command fails, maybe even why. Thank you.
Alex

@gopherbot
Copy link
Author

Comment 14 by chanwit:

I ran bash -x run and kept outputs in the log.
$ bash -x run 2> log
cannot create 8.out.exe
The "cannot create 8.out.exe" message appeared like above.
Attached is the log file.
Chanwit

Attachments:

  1. log (6004 bytes)

@alexbrainman
Copy link
Member

Comment 15:

It looks like linker
8l sortmain.8
can't write to the output file 8.out.exe.
I don't know why. Perhaps, the file is still locked by the previously running program
process (cat_rot13).
Could you put 1 second sleep at the end of testit and testitpipe functions like that:
diff -r 96d9616ffbad doc/progs/run
--- a/doc/progs/run     Wed Jun 01 14:17:09 2011 +1000
+++ b/doc/progs/run     Thu Jun 02 14:05:20 2011 +1000
@@ -41,6 +41,7 @@
        then
                echo $1 failed: '"'$x'"' is not '"'$3'"'
        fi
+       sleep 1
 }
 function testitpipe {
@@ -50,6 +51,7 @@
        then
                echo $1 failed: '"'$x'"' is not '"'$3'"'
        fi
+       sleep 1
 }
and re-run the exercise.
Thank you.
Alex

@gopherbot
Copy link
Author

Comment 16 by chanwit:

Adding sleep commands seems to get it working. Thanks.

@gopherbot
Copy link
Author

Comment 17 by chanwit:

Just an update:
I recently found that 3 students in my classes are randomly encountering the same
problem that 8l.exe cannot write output files.

@gopherbot
Copy link
Author

Comment 18 by chanwit:

Hi
I submitted another patch adding "sleep 1" and "if $GOOS".
Hope it's working better.

Attachments:

  1. go_1899_r2.patch (840 bytes)

@alexbrainman
Copy link
Member

Comment 19:

Thanks, but no. I think "sleep 1" just masking the problem. I would like to really
understand what is going on here.
Alex

@peterGo
Copy link
Contributor

peterGo commented Jun 6, 2011

Comment 20:

How exactly did you install MinGW/MSYS?

@gopherbot
Copy link
Author

Comment 21 by chanwit:

I used the installer provided by MinGW.

@alexbrainman
Copy link
Member

Comment 22:

I use Joe's "prepackaged" files: https://bitbucket.org/jpoirier/go_mingw/downloads.
Perhaps you could try them and see if that fixes your problem. Thank you.

@gopherbot
Copy link
Author

Comment 23 by chanwit:

Hi Alex,
I just tried Joe's go_mingw package and it didn't help.

@alexbrainman
Copy link
Member

Comment 24:

I'm running out ideas. Let's leave it for now. Perhaps someone will suggest something.

@mattn
Copy link
Member

mattn commented Jun 15, 2011

Comment 25:

A cause of failing test in helloworld3 is code page.
If you want to check, type following before exec "bash -x run"
# chcp 65001
# bash -x run
What version of bash.exe do you use? provided from msys? or not? check with following on
your bash.
# which bash
Please part of output of env.

@alexbrainman
Copy link
Member

Comment 26:

Just an update,
I can reproduce your problem on Windows 7 PCs.
I think the problem here is that Windows opens and reads 8.out.exe file in between it
gets executed by Windows and gets re-created by 8l.exe again. I have used ProcessMonitor
to diagnose problem. Please see log.txt attached for the output. I put some comments
there to interpret the data.
We are not the only ones affected. There are a few people complaining. One of those is:
http://stackoverflow.com/questions/3764072/c-win32-how-to-wait-for-a-pending-delete-to-complete.
I hit this problem while running other parts of go build as well:
doc/progs/run
test/bench/timing.sh
test/run
Not sure what to do yet.
Alex

Attachments:

  1. log.txt (13328 bytes)

@alexbrainman
Copy link
Member

Comment 27:

Issue #1834 has been merged into this issue.

@gopherbot
Copy link
Author

Comment 28 by jp@webmaster.ms:

Why not to have unique executable file name for each test instead of recreating
8.out.exe ?

@alexbrainman
Copy link
Member

Comment 29:

That should work. But the scripts will be more complicated.

@gopherbot
Copy link
Author

Comment 30 by webmaster@webmaster.ms:

There are also test scripts like test/64bit.go which explicitly create two exe files
under same name.
So this solution implies modification more files than just test/run
I think, linker just have to wait and try again after receiving the "Permission Denied"
error.

@alexbrainman
Copy link
Member

Comment 31:

I was think about that too. Does not feel right. How long do you wait? How many try you
attempt to go ahead? What if "Permission Denied" is permanent? I was hoping there is
better solution there. Perhaps we need some special flag to CreateFile or something.

@gopherbot
Copy link
Author

Comment 32 by webmaster@webmaster.ms:

Waiting actually did not help, sometimes it takes very long time.
Renaming helps.
I'll submit CL.

@gopherbot
Copy link
Author

Comment 33 by hectorchu:

Fixed by
https://code.google.com/p/go/source/detail?r=f650efd9ed8da7a203d08e88cc9361d627bc7ab1.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants