Skip to content

Commit

Permalink
bugfix: higher mode bits on local connection
Browse files Browse the repository at this point in the history
  • Loading branch information
arlimus committed Jul 10, 2016
1 parent f64da2e commit d028748
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/train/transports/local_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def stat

@stat = {
type: Train::Extras::Stat.find_type(file_stat.mode),
mode: file_stat.mode & 00777,
mode: file_stat.mode & 07777,
mtime: file_stat.mtime.to_i,
size: file_stat.size,
owner: pw_username(file_stat.uid),
Expand Down
3 changes: 3 additions & 0 deletions test/integration/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ test ! -e /tmp/symlink && \
chmod 0777 /tmp/symlink
chmod 0765 /tmp/file

echo -n 'hello suid/sgid/sticky' > /tmp/sfile
chmod 7765 /tmp/sfile

test ! -e /tmp/pipe && \
mkfifo /tmp/pipe

Expand Down
7 changes: 7 additions & 0 deletions test/integration/cookbooks/test/recipes/prep_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
content 'hello world'
end

file '/tmp/sfile' do
mode '7765'
owner 'root'
group gid
content 'hello suid/sgid/sticky'
end

directory '/tmp/folder' do
mode '0567'
owner 'root'
Expand Down
7 changes: 7 additions & 0 deletions test/integration/tests/path_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,11 @@
j['type'].must_equal :file
end
end

describe 'regular file' do
let(:file) { backend.file('/tmp/sfile') }
it 'has mode 7765' do
file.mode.must_equal(07765)
end
end
end

0 comments on commit d028748

Please sign in to comment.