Browse Source

Default permission bits are 0666

Jakob Borg 11 years ago
parent
commit
1a231d39a5
2 changed files with 6 additions and 5 deletions
  1. 5 4
      protocol/PROTOCOL.md
  2. 1 1
      scanner/walk.go

+ 5 - 4
protocol/PROTOCOL.md

@@ -388,7 +388,7 @@ The Flags field is made up of the following single bit flags:
      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-    |              Reserved             |I|D|   Unix Perm. & Mode   |
+    |              Reserved           |P|I|D|   Unix Perm. & Mode   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 
  - The lower 12 bits hold the common Unix permission and mode bits. An
@@ -406,10 +406,11 @@ The Flags field is made up of the following single bit flags:
 
  - Bit 17 ("P") is set when there is no permission information for the
    file. This is the case when it originates on a non-permission-
-   supporting file system. Changes to only permission bits should be
-   disregarded on files with this bit set.
+   supporting file system. Changes to only permission bits SHOULD be
+   disregarded on files with this bit set. The permissions bits MUST be
+   set to the octal value 0666.
 
- - Bit 0 through 17 are reserved for future use and SHALL be set to
+ - Bit 0 through 16 are reserved for future use and SHALL be set to
    zero.
 
 The hash algorithm is implied by the Hash length. Currently, the hash

+ 1 - 1
scanner/walk.go

@@ -250,7 +250,7 @@ func (w *Walker) walkAndHashFiles(res *[]File, ign map[string][]string) filepath
 
 			var flags = uint32(info.Mode() & os.ModePerm)
 			if w.IgnorePerms {
-				flags = protocol.FlagNoPermBits
+				flags = protocol.FlagNoPermBits | 0666
 			}
 			f := File{
 				Name:     rn,