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

cmd/dist: emit \r in 'env -w' output #3060

Closed
jpoirier opened this issue Feb 17, 2012 · 7 comments
Closed

cmd/dist: emit \r in 'env -w' output #3060

jpoirier opened this issue Feb 17, 2012 · 7 comments

Comments

@jpoirier
Copy link
Member

What steps will reproduce the problem?
1. go tool dist env > temp.txt 
2. pkg\tool\windows_386\dist.exe > temp.txt


What is the expected output? What do you see instead?
Looking at temp.txt file's end-of-lines in an editor shows \n rather than the expected
\r\n,  Windows end-of-lines.

Depending on how the output is used, some Windows apps may have problems handling the
Unix EOLs, e.g.  Notepad. I had problems parsing the output file from a batch file.
@rsc
Copy link
Contributor

rsc commented Feb 17, 2012

Comment 1:

Did you have problems in the batch file or problems in Notepad?
I'm not super worried about Notepad: there are tools on Windows
that can handle \n just fine (like any web browser) and dist is
consistent with all the other programs that print output.

@jpoirier
Copy link
Member Author

Comment 2:

The problem showed up in a batch file; Notepad was just an easy
target. I did hesitate on submitting the bug report...
-joe

@rsc
Copy link
Contributor

rsc commented Feb 17, 2012

Comment 3:

Does the batch file run without the \r at end of line?
I assume it does, since I have been writing a bunch
like that myself (by hand), and that Notepad just had
trouble editing it for you.
Russ

@gopherbot
Copy link

Comment 4 by hongruiqi:

env.bat can't run in my win7
I:\MinGW\go\src>make.bat
# Building C bootstrap tool.
cmd/dist
'\MinGW\go\bin' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'86' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'dows' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'CH' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'windows' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
'R' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
系统找不到指定的路径。
The chinese above means comannds 86, dows, etc can't be found...

@gopherbot
Copy link

Comment 5 by hongruiqi:

Test again, when the path in the bat contains Chinese words with \n line-ending, it's
wrong. After I change \n to \r\n the bat runs. but part of path that in Chinese is messy
and unusable. Without Chinese, all is ok.
Maybe there is some encoding problem in windows.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 6:

I'm hesitant to add \r to all of dist's output but we can easily add it to the env -w
output.

Owner changed to @rsc.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 7:

This issue was closed by revision 792518c.

Status changed to Fixed.

rsc added a commit that referenced this issue May 11, 2015
««« backport 108165c03c70
cmd/dist: emit \r in env -w output

go tool dist env -w is supposed to print a Windows batch file.
Normally Windows will execute batch files without \r before \n,
but issue 3060 reports that if the file ends up containing paths
written in Chinese, Windows 7 cannot execute it without the \r.
So add the \r.

Fixes #3060.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6498120

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
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

3 participants