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

"dotnet new mini-scaffold" on Linux strips execute bit from build.sh #19

Closed
rmunn opened this issue Jun 30, 2017 · 6 comments · Fixed by #37
Closed

"dotnet new mini-scaffold" on Linux strips execute bit from build.sh #19

rmunn opened this issue Jun 30, 2017 · 6 comments · Fixed by #37

Comments

@rmunn
Copy link
Contributor

rmunn commented Jun 30, 2017

The build.sh file checked into the Git repo has the execute bit properly set, but after I run dotnet new -i "MiniScaffold::*" and then dotnet new mini-scaffold, the resulting files have build.sh without the execute bit. This is just a minor annoyance as it's easy to immediately run chmod +x build.sh, but if it can be fixed in the template that would be nice.

I rather suspect, though, that this is a limitation in the dotnet templating engine, in which case you can't fix it in the template. If that's the case, feel free to just close this issue. :-)

System info:

Dotnet version: 2.0.0-preview2-006497
OS version: Linux Mint 18.1 (based on Ubuntu Xenial 16.04)

@TheAngryByrd
Copy link
Owner

Hmm I haven't tried 2.0.0-preview2-006497. Can you try with the 1.0.x version?

@rmunn
Copy link
Contributor Author

rmunn commented Jul 1, 2017

My home computer has dotnet 1.0.1 (which I apparently installed on February 28th and forgot about until now), so I was able to try with 1.0.1. Doing so produced the amusing result that every file had the execute bit set! Specifically, running dotnet new -i "MiniScaffold::*" and then dotnet new mini-scaffold under dotnet 1.0.1 produced a project directory where every file was mode 744 (rwx for owner, r-- for group and other), and every directory was mode 755.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 2, 2017

Related: https://github.com/dotnet/coreclr/issues/11232

There are several other related issues and PRs in the coreclr repo, but I'm currently on a mobile phone so it's a bit difficult to reference all of them. I'll add more details when I get back to a computer. But basically, the 1.0 tools set the execute bit everywhere, and a PR was created to fix that bug by not setting the execute bit at all. I'm not yet sure if the tools have access to the needed information to correctly set the execute bit only on the files for which it was set in the Git repo. I haven't yet been able to tell if templates can specify execute bits in some way, so I'll keep this issue open until I'm sure it can't be fixed by templates.

@rmunn
Copy link
Contributor Author

rmunn commented Jul 3, 2017

It looks like the ultimate cause of this issue is NuGet/Home#4424. Comments in that issue's thread say that the relevant bug has been fixed, but that that fix didn't make it into the 2.0.0-preview2-006497 version of the .Net CLI tools. So I'll just need to test against the CLI tools once preview3 comes out (or the official release if they don't put out a preview 3), and see whether the execute bit is getting restored properly at that point.

Meanwhile, I think it's safe to close this particular issue since there's nothing you need to change in the template, as far as I know. If the preview3 release comes out and it turns out that the template does need to do something special besides having the execute bit set in the Git repo, then I'll reopen this issue.

@rmunn rmunn closed this as completed Jul 3, 2017
@TheAngryByrd
Copy link
Owner

Thanks for the investigation!

@mlorbetske
Copy link

For dotnet new, we're looking at ways of preserving or setting permissions on generated content here dotnet/templating#1028

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants