Skip to content
This repository has been archived by the owner on Sep 26, 2020. It is now read-only.

build.sh has default Windows line endings (^M) #19

Closed
vsinha opened this issue Dec 9, 2016 · 13 comments
Closed

build.sh has default Windows line endings (^M) #19

vsinha opened this issue Dec 9, 2016 · 13 comments

Comments

@vsinha
Copy link

vsinha commented Dec 9, 2016

build.sh generated by the console template has ^M windows line endings, which prevents the shell script from running on OSX/UNIX.

Upon further investigation the file at temp/templates/.fake/build.sh does not have the line endings problem!

Could it be due to the copy operation being performed by mono Forge.exe? I found this problem when using the ionide/vscode F# New Project command

@jamesjrg
Copy link
Contributor

If I build forge locally with Mono and then run temp/forge.sh new project --name test I get a build.sh with Linux line endings.

If I install forge in Ubuntu via the VS Code package manager then the file installed at ~/.vscode/extensions/Ionide.Ionide-fsharp-2.13.0/templates/.fake/build.sh has CRLF line endings.

So I wonder if the problem is caused by some stage in creation of a VS Code package or in the installation of said package. I had a bit of a go at debugging this by running the BuildPackage target in the ionide fsharp git repo but the package it created didn't include any templates from Forge. I also tried running the ZipRelease target in this repo but it again didn't include any templates from the templates branch. So basically I don't really know how the templates from the templates branch of this repo eventually end up in package created in the ionide fsharp repo.

@vsinha
Copy link
Author

vsinha commented Dec 10, 2016

I think it's the Fake.Copy operation which moves the folder contents over: https://github.com/fsharp-editing/Forge/blob/cf54a89d8584870df9ae3196328b5a674c97da09/src/Forge.Core/Templates.fs#L193

@jamesjrg
Copy link
Contributor

That does the copy from the templates folder to your project folder. However I don't think that is the problem. When I build forge locally the file still has Linux line endings after the copy. When I install forge as part of the VS Code Ionide extension the line endings are already wrong in the shared templates folder.

@vsinha
Copy link
Author

vsinha commented Dec 10, 2016

Oh I see the distinction you're making.

Will continue to look into it

EDIT: Found the build.sh installed at the shared templates folder (ie at ~/.vscode/extensions/Ionide.Ionide-fsharp-1.9.2/templates/.fake/build.sh)

can confirm that it does have the wrong line endings:

$ file ~/.vscode/extensions/Ionide.Ionide-fsharp-1.9.2/templates/.fake/build.sh
build.sh: Bourne-Again shell script text executable, ASCII text, with CRLF line terminators

@vsinha
Copy link
Author

vsinha commented Dec 12, 2016

So this means it's part of the ionide-vscode installation process-- which pulls down fake and forge templates but leaves them in the extensions folder with the wrong line endings. Right?

Tangentially i'm unable to run my fork of the ionide-vscode extension locally-- when i attempt to run F#: New Project in the vscode extension host instance it returns 'No templates found. Run F#: Refresh Project Templates command`. Running that command accomplishes nothing.

I'm struggling to dig deeper at this point, any help would be great :D

@Krzysztof-Cieslak
Copy link
Member

I think it might be problem with the fact I;m deploying Ionide from Windows machine.

I actually wonder if changing file endings (if on mono) in Forge during scaffolding project is not a simplest solution.

@jamesjrg
Copy link
Contributor

What is the script or process that copies the templates from the templates branch of this project, into the distribution of the ionide project, ready to be included in the vsix? It seems unlikely that anything is going to alter the contents of the vsix once it has been built. The bug is presumably somewhere in the packaging - i.e. after building, but before pushing to the VSCode extension gallery.

@Krzysztof-Cieslak
Copy link
Member

Try Ionide 2.13.1

@jamesjrg
Copy link
Contributor

$ cd ~/.vscode/extensions/Ionide.Ionide-fsharp-2.13.1/templates/.fake
$ file build.sh
build.sh: Bourne-Again shell script, ASCII text executable, with CRLF line terminators

@Krzysztof-Cieslak
Copy link
Member

Try creating project, I've added changing line endings during project scaffolding in Forge(c958f1c)

@jamesjrg
Copy link
Contributor

It looks like it's still got CRLF line endings, though I guess it's possible it's some sort of local config problem

@taimila
Copy link

taimila commented Jan 10, 2017

I'm still facing this bug with the latest Ionide install (2.19.0). For me this is a major bug that really hinders the ionide experience on mac. Hopefully we can find the solution to this.

When using mac you can check the line endings by running this command in terminal cat -v build.sh. If you see ^M it won't work. To fix the file I ran tr -d '\r' < build.sh > new_build.sh and then renamed the new file to be build.sh. After that everything seems to be working.

@Krzysztof-Cieslak
Copy link
Member

Should be fixed as part of #71

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

4 participants