Class: HotCell::Fixtures::UnremovableHome

Inherits:
Operation
  • Object
show all
Defined in:
lib/hot_cell/test_operations.rb

Overview

Leaves its $HOME in a state the worker cannot remove, by taking write permission off a subdirectory that still has a file in it. A tool running as this user can do the same to a sibling's directory, which is why a removal that fails has to be reported rather than swallowed.

Constant Summary

Constants inherited from Operation

Operation::READ_BYTES

Instance Method Summary collapse

Methods inherited from Operation

abstract_operation, abstract_operation?, before_fork, before_worker_boot, inherited, limits, operation, operation_name, #run_tool, unreadable

Instance Method Details

#perform(_inputs, _outputs) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/hot_cell/test_operations.rb', line 77

def perform(_inputs, _outputs)
  blocked = File.join(ENV["HOME"].to_s, "blocked")
  FileUtils.mkdir_p blocked
  File.write File.join(blocked, "file"), "x"
  File.chmod 0o500, blocked

  { blocked: blocked }
end