summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-10-10 15:18:46 +0000
committerRobert Speicher <robert@gitlab.com>2016-10-10 15:18:46 +0000
commit1659c3b8717307ebbd01fdf79fc1201dc25f25ae (patch)
tree52959d137c180d7ef018cda939bd80c9856b1c48
parent4ce9a783b552ebb9b667b3f7cca5230d321b04eb (diff)
parent05745737c659098d3cc1e9ae0f8eedddac7b3603 (diff)
downloadgitlab-ce-1659c3b8717307ebbd01fdf79fc1201dc25f25ae.tar.gz
Merge branch 'explain-0600' into 'master'
Explain the extra chmod There is confusion about what passing `0600` to File.open does. ``` $ touch /tmp/foobar $ ls -l /tmp/foobar -rw-r--r-- 1 jacobvosmaer wheel 0 Sep 26 14:20 /tmp/foobar $ ruby -e 'File.open("/tmp/foobar", "w", 0600)' $ ls -l /tmp/foobar -rw-r--r-- 1 jacobvosmaer wheel 0 Sep 26 14:20 /tmp/foobar $ $ $ rm /tmp/foobar $ ruby -e 'File.open("/tmp/foobar", "w", 0600)' $ ls -l /tmp/foobar -rw------- 1 jacobvosmaer wheel 0 Sep 26 14:21 /tmp/foobar ``` See merge request !6523
-rw-r--r--lib/gitlab/workhorse.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/workhorse.rb b/lib/gitlab/workhorse.rb
index 5d33f98e89e..594439a5d4b 100644
--- a/lib/gitlab/workhorse.rb
+++ b/lib/gitlab/workhorse.rb
@@ -111,7 +111,7 @@ module Gitlab
def write_secret
bytes = SecureRandom.random_bytes(SECRET_LENGTH)
File.open(secret_path, 'w:BINARY', 0600) do |f|
- f.chmod(0600)
+ f.chmod(0600) # If the file already existed, the '0600' passed to 'open' above was a no-op.
f.write(Base64.strict_encode64(bytes))
end
end