newaetech / chipwhisperer

ChipWhisperer - the complete open-source toolchain for side-channel power analysis and glitching attacks
http://chipwhisperer.com
Other
1.12k stars 285 forks source link

CHIPWHISPERER_DIR has wrong format in Python3 #180

Closed Marandil closed 6 years ago

Marandil commented 6 years ago

In software/chipwhisperer/tests/tools_for_tests.py, several paths are defined as relative paths to CHIPWHISPERER_DIR. The base directory, however, is incorrectly obtained as relative to a filename, thus resulting in incorrect unix paths, e.g.: /home/user/git/cw5dev/software/chipwhisperer/__init__.py/../../...

A more reliable and correct way to obtain the path would be to use dirname instead, and apply abspath as the last step (after joining parent dir):

-CHIPWHISPERER_DIR = os.path.join(os.path.abspath(cw.__file__), os.pardir, os.pardir, os.pardir)
+CHIPWHISPERER_DIR = os.path.abspath(os.path.join(os.path.dirname(cw.__file__), os.pardir, os.pardir))
colinoflynn commented 6 years ago

Thanks for the fix! We ran into that a number of times before but hadn't gotten around to fixing it, so will push that into the main.