You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2015-04-13.17:15:22.057>created_at=<Date2013-02-14.06:41:26.826>labels= ['type-bug', 'OS-windows']
title='Add .bat line to .hgeol'updated_at=<Date2015-04-13.17:15:22.053>user='https://github.com/zware'
Most times (though not all, for some reason) I try to use Doc\make.bat update, it fails with "The system cannot find the batch label specified - update" even though it is obviously there. The reason for this appears to be the fact that the file uses UNIX line endings[1]. As a fix, I think it would make the most sense to add a "**.bat = CRLF" line to .hgeol.
The attached patch makes that change and includes the changes that that change entails. The complete list of affected files is as follows:
As far as I know, there is no reason to believe that the changes to line endings in these files would cause any change to behavior other than possibly avoid strange and random bugs in their execution, particularly in Doc\make.bat.
If we don't want to a blanket rule like this, I think we should at least add a rule for Doc\make.bat to convert it to CRLF line endings to avoid the bug with :update.
I have recently learned why this issue had seemed transient to me previously: the hg eol extension apparently causes hg to create all files that are not explicitly set to LF or BIN using CRLF on Windows. Thus, this is what happens:
"""
P:\Python\cpython\Doc>rem In a fresh checkout made with the 'eol' extension disabled:
P:\Python\cpython\Doc>make.bat update
The system cannot find the batch label specified - update
P:\Python\cpython\Doc>make.bat update
Updating 'tools\sphinx':
At revision 89001.
Updating 'tools\docutils':
At revision 89001.
Updating 'tools\jinja2':
At revision 89001.
Updating 'tools\pygments':
At revision 89001.
P:\Python\cpython\Doc>
"""
Thus, a usable workaround is to enable the eol extension in hgrc and make your checkout that way. However, this doesn't help anyone who is trying to build from a tarball; Doc/make.bat will have LF line endings and at least 'update' will not work.
Perhaps a less extensive change would be to add "**.bat = BIN", and then convert Doc/make.bat to CRLF explicitly?
loewis commented on Jul 15, 2013
loewismannequin
Mannequin
More actions
Zachary: What Windows version do you use? Glen Linderman claims that at least Windows 7 should work fine with cmd files containing only LF, and suggested that this may also be the case on Windows XP.
Are you using a non-standard command interpreter by any chance?
I'm on 32 bit Windows 7 Pro, SP1, and have also reproduced the issue on 64 bit Windows 7 Home Premium, SP1. I use the standard Command Prompt (cmd.exe) on both.
I'm running Win7 and have the same problem, with a fresh checkout and the eol extension disabled. The attached (updated) patch does solve the issue. I can't see any reason not to apply it, even if it's not needed in many cases.
Activity
zware commentedon Feb 14, 2013
Most times (though not all, for some reason) I try to use Doc\make.bat update, it fails with "The system cannot find the batch label specified - update" even though it is obviously there. The reason for this appears to be the fact that the file uses UNIX line endings[1]. As a fix, I think it would make the most sense to add a "**.bat = CRLF" line to .hgeol.
The attached patch makes that change and includes the changes that that change entails. The complete list of affected files is as follows:
Doc\make.bat
Lib\ctypes\macholib\fetch_macholib.bat
Lib\idlelib\idle.bat
Modules\_decimal\tests\runall.bat
PCbuild\build.bat
PCbuild\build_env.bat
PCbuild\build_pgo.bat
PCbuild\build_ssl.bat
PCbuild\env.bat
PCbuild\idle.bat
PCbuild\rt.bat
Tools\buildbot\build-amd64.bat
Tools\buildbot\build.bat
Tools\buildbot\buildmsi.bat
Tools\buildbot\clean-amd64.bat
Tools\buildbot\clean.bat
Tools\buildbot\external-amd64.bat
Tools\buildbot\external-common.bat
Tools\buildbot\external.bat
Tools\buildbot\test-amd64.bat
Tools\buildbot\test.bat
Tools\unicode\genwincodecs.bat
As far as I know, there is no reason to believe that the changes to line endings in these files would cause any change to behavior other than possibly avoid strange and random bugs in their execution, particularly in Doc\make.bat.
If we don't want to a blanket rule like this, I think we should at least add a rule for Doc\make.bat to convert it to CRLF line endings to avoid the bug with :update.
Thanks,
Zach
[1] http://stackoverflow.com/questions/232651/why-the-system-cannot-find-the-batch-label-specified-is-thrown-even-if-label-e/232674#232674
ezio-melotti commentedon Feb 15, 2013
**.bat used to be there, but it was removed in 1762d79eab65.
I have a very faint memory of some discussion about bat files and EOLs, but the best I could find was:
http://mail.python.org/pipermail/python-dev/2012-May/119220.html
http://mail.python.org/pipermail/python-dev/2012-May/119225.html
This seems to suggest that CRLF shouldn't be necessary.
There's also an older discussion about adding CRLF for make.bat here (the discussion is actually somewhat unrelated, but back then adding these entries sounded like a good idea): http://mail.python.org/pipermail/python-committers/2011-May/001685.html
zware commentedon Feb 15, 2013
It's not necessary on .bat files without labels, but those with labels are subject to the (Windows) bug described in my first message and link.
Adding an entry specifically for Doc/make.bat and any other batch scripts with labels would be fine as well.
zware commentedon Jul 5, 2013
I have recently learned why this issue had seemed transient to me previously: the hg eol extension apparently causes hg to create all files that are not explicitly set to LF or BIN using CRLF on Windows. Thus, this is what happens:
"""
P:\Python\cpython\Doc>rem In a fresh checkout made with the 'eol' extension disabled:
P:\Python\cpython\Doc>make.bat update
The system cannot find the batch label specified - update
P:\Python\cpython\Doc>cd ..
P:\Python\cpython>hg up null
0 files updated, 0 files merged, 3689 files removed, 0 files unresolved
P:\Python\cpython>hg --config extensions.eol= up default
3689 files updated, 0 files merged, 0 files removed, 0 files unresolved
P:\Python\cpython>cd Doc
P:\Python\cpython\Doc>make.bat update
Updating 'tools\sphinx':
At revision 89001.
Updating 'tools\docutils':
At revision 89001.
Updating 'tools\jinja2':
At revision 89001.
Updating 'tools\pygments':
At revision 89001.
P:\Python\cpython\Doc>
"""
Thus, a usable workaround is to enable the eol extension in hgrc and make your checkout that way. However, this doesn't help anyone who is trying to build from a tarball; Doc/make.bat will have LF line endings and at least 'update' will not work.
Perhaps a less extensive change would be to add "**.bat = BIN", and then convert Doc/make.bat to CRLF explicitly?
loewis commentedon Jul 15, 2013
Zachary: What Windows version do you use? Glen Linderman claims that at least Windows 7 should work fine with cmd files containing only LF, and suggested that this may also be the case on Windows XP.
Are you using a non-standard command interpreter by any chance?
zware commentedon Jul 15, 2013
I'm on 32 bit Windows 7 Pro, SP1, and have also reproduced the issue on 64 bit Windows 7 Home Premium, SP1. I use the standard Command Prompt (cmd.exe) on both.
tjguk commentedon Oct 24, 2013
I'm running Win7 and have the same problem, with a fresh checkout and the eol extension disabled. The attached (updated) patch does solve the issue. I can't see any reason not to apply it, even if it's not needed in many cases.
zware commentedon Dec 19, 2013
Any objections to proceeding with this?
BreamoreBoy commentedon Jan 3, 2015
No objections so proceeding is in order here I take it?
python-dev commentedon Apr 13, 2015
New changeset 019c17a4198a by Zachary Ware in branch '2.7':
Issue bpo-17202: Add .bat to .hgeol to force them to CRLF.
https://hg.python.org/cpython/rev/019c17a4198a
New changeset 640ccb924b5f by Zachary Ware in branch '3.4':
Issue bpo-17202: Add .bat to .hgeol to force them to CRLF.
https://hg.python.org/cpython/rev/640ccb924b5f
New changeset 9b2ea49213fd by Zachary Ware in branch 'default':
Closes bpo-17202: Merge with 3.4
https://hg.python.org/cpython/rev/9b2ea49213fd