prosyslab-classroom / is593-language-based-security

28 stars 6 forks source link

[Homework 5] Dependency in shell scripts and a minor issue in README #32

Closed hyunsukimsokcho closed 4 years ago

hyunsukimsokcho commented 4 years ago

I see problematic dependency in given shell scripts. (test/example*.sh) These scripts assume that target example*.ll file is located at the command execution path.

My suggestion is adding cd "{0%/*}" at the beginning of each shell scripts. For example, example1.sh will become:

#!/bin/bash
cd "${0%/*}"

NAME=example1

clang -o ${NAME} ${NAME}.ll >&/dev/null && ./${NAME}

Then, the output (without implementation of ddmin) becomes:

Iteration 1, # Instrs = 10
-- running dd_global
Fatal error: exception Failure("Not implemented")

My idea is fixing shell scripts in a way that is agnostic to the path being executed (by forcing cd to desired working directory). ref


Also, in README, I think Function is rather Global according to the code (src/debloat.ml):

KihongHeo commented 4 years ago

Thanks for the good suggestion. It will be good to use such thing if you want to more generalize the tool.

TA will run your code under the same directory with each shell script. So do not worry about the evaluation.

KihongHeo commented 4 years ago

I fixed README yesterday. So students who checkout after my fix will have the correct document.

hyunsukimsokcho commented 4 years ago

Thanks for the confirm and prompt reply!

KihongHeo commented 4 years ago

Reopen for other students.

KunJeong commented 4 years ago

Hi. I don't think I fully understand what's going on here. Since I checked out earlier than your update, may I ask for the correct fix?

KihongHeo commented 4 years ago

Nothing serious but just a typo in README.

Function -> Global

KunJeong commented 4 years ago

Hmm. The error in #33 still occurs even when I run ../debloater example1.sh example1.ll in the test directory. Perhaps it's a different issue?

KihongHeo commented 4 years ago

Perhaps,

../debloater ./example1.sh example1.ll

?

KunJeong commented 4 years ago

Oh, that works well. Thank you.

KihongHeo commented 4 years ago

Good. Sorry I am not a human-friendly front-end programmer.

KunJeong commented 4 years ago

Haha no it's fine. I've never understood why the ./ is necessary though.