squaresLab / BugZoo

Keep your bugs contained. A platform for studying historical software bugs.
https://squareslab.github.io/BugZoo
MIT License
67 stars 12 forks source link

Compile with coverage fails due to instrumented files permission #306

Closed afsafzal closed 5 years ago

afsafzal commented 5 years ago
preparing containers
Traceback (most recent call last):
  File "experiments/build_traces.py", line 128, in <module>
    build_traces(client_bugzoo, snapshot, missions, num_threads, args.output)
  File "experiments/build_traces.py", line 91, in build_traces
    client_bugzoo.containers.prepare_for_coverage(container)
  File "/home/afsoona/py3/lib/python3.6/site-packages/bugzoo/mgr/container.py", line 350, in prepare_for_coverage
    self.coverage_extractor(container).prepare()
  File "/home/afsoona/py3/lib/python3.6/site-packages/bugzoo/mgr/coverage/gcov.py", line 208, in prepare
    raise Exception(msg)
Exception: failed to generate coverage for container (33ae59fc-1ba9-4e19-b162-9d2120d25ae6) due to compilation failure.

Manually compiling in the container after instrumentation:

Build failed
Traceback (most recent call last):
  File "/opt/ardupilot/modules/waf/waflib/Runner.py", line 270, in task_status
    return tsk.runnable_status()
  File "/opt/ardupilot/modules/waf/waflib/Task.py", line 653, in runnable_status
    new_sig = self.signature()
  File "Tools/ardupilotwaf/ap_persistent.py", line 32, in _signature
    s = _original_signature(self)
  File "/opt/ardupilot/modules/waf/waflib/Task.py", line 626, in signature
    self.sig_explicit_deps()
  File "/opt/ardupilot/modules/waf/waflib/Task.py", line 714, in sig_explicit_deps
    upd(x.get_bld_sig())
  File "/opt/ardupilot/modules/waf/waflib/Node.py", line 922, in get_bld_sig
    ret = cache[self] = self.h_file()
  File "/opt/ardupilot/modules/waf/waflib/Node.py", line 902, in h_file
    return Utils.h_file(self.abspath())
  File "/opt/ardupilot/modules/waf/waflib/Utils.py", line 251, in h_file
    f = open(fname, 'rb')
IOError: [Errno 13] Permission denied: '/opt/ardupilot/ArduCopter/ArduCopter.cpp'
ChrisTimperley commented 5 years ago

Just to double check: What version of BugZoo are you using?

afsafzal commented 5 years ago

2.1.21

ChrisTimperley commented 5 years ago

It looks like FileManager.write is failing to preserve the original permissions of the file inside the container. Below is an approximate trace of the calls that are made during the coverage instrumentation call: https://github.com/squaresLab/BugZoo/blob/master/bugzoo/mgr/coverage/gcov.py#L200 https://github.com/squaresLab/BugZoo/blob/master/bugzoo/mgr/file.py#L116 https://github.com/squaresLab/BugZoo/blob/master/bugzoo/mgr/container.py#L460

When the file is copied from the host to the container, via docker cp, it, incorrectly, retains the original permissions of that file. Instead, copy_to should retain the original permissions of the file. Strangely, I thought that I had fixed this bug a while back.