question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`dotnet new` should not set executable mode on generated files; also, obey umask

See original GitHub issue

Steps to reproduce

$ ssh some-mac-box
$ mkdir foo
$ cd foo
$ dotnet new
$ ls -l

Expected behavior

Given the OS X default umask = 0022, the output of the ls -l command should be:

-rw-r--r--  1 wyoung  staff  386 Mar  9 10:54 NuGet.Config
-rw-r--r--  1 wyoung  staff  202 Mar  9 10:54 Program.cs
-rw-r--r--  1 wyoung  staff  227 Mar  9 10:54 project.json

Actual behavior

All three generated plain text files have their executable bit set, and the default permissions selected by the user with their umask setting are ignored:

-rwx------  1 wyoung  staff  386 Mar  9 10:54 NuGet.Config*
-rwx------  1 wyoung  staff  202 Mar  9 10:54 Program.cs*
-rwx------  1 wyoung  staff  227 Mar  9 10:54 project.json*

Environment data

dotnet --version output:

.NET Command Line Tools (1.0.0-beta-001598)

Product Information:
 Version:     1.0.0-beta-001598
 Commit Sha:  7582649f88

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.10
 OS Platform: Darwin
 Runtime Id:  osx.10.10-x64

This also affects the current Ubuntu 14.04 build as well:

.NET Command Line Tools (1.0.0-beta-001668)

Product Information:
 Version:     1.0.0-beta-001668
 Commit Sha:  N/A

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  14.04
 OS Platform: Linux
 Runtime Id:  ubuntu.14.04-x64

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mlorbetskecommented, Jan 25, 2017

@seancpeters lets try this out on in the morning to make sure the files in the archive have the right permissions set

0reactions
blackdwarfcommented, Jan 26, 2017

Thanks @mlorbetske, will close this one then since the fix is not in the CLI and we have dotnet/coreclr#7995.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet new should not set executable mode on generated ...
Looking through the new command code, it seems like it just extracts a zip file with the template structure in it. So, maybe...
Read more >
Why doesn't umask change execute permissions on files?
umask is subtractive, not prescriptive: permission bits set in umask are removed by default from modes specified by programs, but umask ...
Read more >
Avoid having subversion modify Linux file permissions.
Every time I run an svn update , or svn co , even though the files may not be created (i.e. svn update...
Read more >
Why are newly-created files under /root not executable ...
My /root directory permissions are dr-xr-x--- and my umask is 0022 . As I understand, I should expect new files to be 0755...
Read more >
Why umask 555 is setting the file mods to "222" instead of " ...
Short answer: Because with a 5 you are removing the read (4) and executable (1) bit, so you end up with only write...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found