skyhover / Deckard

Code clone detection; clone-related bug detection; sematic clone analysis
Other
209 stars 78 forks source link

Clone detection failure?need help #22

Closed lyeeer closed 5 years ago

lyeeer commented 5 years ago

I followed the steps what README.md say. But when I installed the Deckard,I want to test the clone detection... I create a "config" file in the path /home/xx/projects/Deckard,And the content is same as "config" in /sample, The configuration file is as follows:


FILE_PATTERN='*.java' # used in the 'find' command below

where are the source files?

SRC_DIR="src"

The following are for Deckard2's support for dot only

PDG_DIR="ddgs" # used by Deckard2 for 'find $SRC_DIR -ipath "*/$PDG_DIR/$FILE_PATTERN"' AST_DIR="asts" # each pdg should have an ast with the same name in a different folder

where are node definition files? used by Deckard2

TYPE_FILE='/home/ly/projects/Deckard/testdata/deckard3/AstNodeTypeNamesIDs.txt' RELEVANT_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstRelevantNodes.txt' LEAF_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstLeafNodes.txt' PARENT_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstParentNodes.txt'

The above are for Deckard2 only

where is Deckard?

DECKARD_DIR="/home/ly/projects/Deckard"

clone parameters; refer to paper.

MIN_TOKENS='30 50' # can be a sequence of integers STRIDE='2 0' # can be a sequence of integers SIMILARITY='1.0 0.95' # can be a sequence of values <= 1

DISTANCE='0 0.70711 1.58114 2.236'

###########################################################

Where to store result files?

#

where to output generated vectors?

VECTOR_DIR="vectors"

where to output detected clone clusters?

CLUSTER_DIR="clusters"

where to output timing/debugging info?

TIME_DIR="times"

##########################################################

where are several programs we need?

#

where is the vector generator?

VGEN_EXEC="$DECKARD_DIR/src" case $FILE_PATTERN in .dot ) VGEN_EXEC="$VGEN_EXEC/dot2d/dotvgen" ;; # for Deckard2 dot only .java ) VGEN_EXEC="$VGEN_EXEC/main/jvecgen" ;; .php ) VGEN_EXEC="$VGEN_EXEC/main/phpvecgen" ;; .c | *.h ) VGEN_EXEC="$VGEN_EXEC/main/cvecgen" ;;

MAX_PROCS=8

GROUPING_S='30' # should be a single value

GROUPING_D

GROUPING_C

export DECKARD_DIR export FILE_PATTERN export SRC_DIR export PDG_DIR export AST_DIR

export TYPE_FILE export RELEVANT_NODEFILE export LEAF_NODEFILE export PARENT_NODEFILE

export VECTOR_DIR export TIME_DIR export CLUSTER_DIR

export VGEN_EXEC export GROUPING_EXEC export CLUSTER_EXEC export POSTPRO_EXEC export SRC2HTM_EXEC export SRC2HTM_OPTS

export MIN_TOKENS export STRIDE

export DISTANCE

export SIMILARITY export GROUPING_S export GROUPING_D export GROUPING_C export MAX_PROCS


But when I follow the next step to run,there will be a error.


`ly@ubuntu:~/projects/Deckard$ sh /home/ly/projects/Deckard/scripts/clonedetect/deckard.sh DECKARD--A Tree-Based Code Clone Detection Toolkit. /home/ly/projects/Deckard/scripts/clonedetect/deckard.sh: 4: /home/ly/projects/Deckard/scripts/clonedetect/deckard.sh: [[: not found

==== Configuration checking.../home/ly/projects/Deckard/scripts/clonedetect/deckard.sh: 81: /home/ly/projects/Deckard/scripts/clonedetect/configure: [[: not found Error: no config file in current directory


I don't know how to fix it..... Can someone give me some advice,Thx

lyeeer commented 5 years ago

The config file,I modified there two places: 1.#where are node definition files? used by Deckard2 TYPE_FILE='/home/ly/projects/Deckard/testdata/deckard3/AstNodeTypeNamesIDs.txt' RELEVANT_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstRelevantNodes.txt' LEAF_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstLeafNodes.txt' PARENT_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstParentNodes.txt'

2.#where is Deckard? DECKARD_DIR="/home/ly/projects/Deckard"

Is there something I haven't modified?

lyeeer commented 5 years ago

I solved this problem. 1.when I run,I used "sh" instead of "bash".../bin/bash is specified in the script,but I ignored. 2.I thought it was sign incompatibility,so I modified "[[ ]]" to "[ ]" according to the reported error message.(: 4: /home/ly/projects/Deckard/scripts/clonedetect/deckard.sh: [[: not found)

Xiaoven commented 5 months ago

where are node definition files? used by Deckard2

TYPE_FILE='/home/ly/projects/Deckard/testdata/deckard3/AstNodeTypeNamesIDs.txt' RELEVANT_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstRelevantNodes.txt' LEAF_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstLeafNodes.txt' PARENT_NODEFILE='/home/ly/projects/Deckard/testdata/deckard3/AstParentNodes.txt'

How to generate this files? Can I run Deckard2 without these variables?