cryptobiu / MATRIX

MPC Simulation Framework
MIT License
24 stars 13 forks source link

fabfile: ~ is expanded to /root #4

Closed lenerd closed 6 years ago

lenerd commented 6 years ago

In the fabfile.py, https://github.com/cryptobiu/MATRIX/blob/174fc07539be07b3bcffd8afc988d6dbb17ae742/Execution/fabfile.py#L72-L78 when the working directory is set to something like ~/somedir, then ~ is expanded to /root instead of the current users home directory when running commands with sudo. This leads to the following errors (here cryptobiu-ABY is the working directory).

Choose task to be executed:
1. Preform pre process operations
2. Install Experiment
3. Execute Experiment
4. Update libscapi
Your choice:3
[127.0.0.1] Executing task 'run_protocol'
[127.0.0.1] sudo: killall -9 run.sh; exit 0
[127.0.0.1] out: /bin/bash: line 0: cd: /root/cryptobiu-ABY: No such file or directory
[127.0.0.1] out: 

[127.0.0.1] sudo: ldconfig ~/boost_1_64_0/stage/lib/ ~/libscapi/install/lib/
[127.0.0.1] out: /bin/bash: line 0: cd: /root/cryptobiu-ABY: No such file or directory
[127.0.0.1] out: 

Fatal error: sudo() received nonzero return code 1 while executing!

Requested: ldconfig ~/boost_1_64_0/stage/lib/ ~/libscapi/install/lib/
Executed: sudo -S -p 'sudo password:'  /bin/bash -l -c "cd ~/cryptobiu-ABY >/dev/null && ldconfig ~/boost_1_64_0/stage/lib/ ~/libscapi/install/lib/"

Aborting.

Fatal error: One or more hosts failed while executing task 'run_protocol'

Aborting.
liorko87 commented 6 years ago

Please supply the following details:

lenerd commented 6 years ago
lenerd commented 6 years ago

It looks like the with cd('~/dir') context just prepends cd ~/cryptobiu-ABY >/dev/null && to the command. When using sudo, ~ is /root instead of the home directory of the user invoking sudo.