Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clone detection failure?need help #22

Closed
lyeeer opened this issue Aug 8, 2019 · 3 comments
Closed

Clone detection failure?need help #22

lyeeer opened this issue Aug 8, 2019 · 3 comments

Comments

@lyeeer
Copy link

lyeeer commented Aug 8, 2019

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" ;;

  • )
    echo "Error: invalid FILE_PATTERN: $FILE_PATTERN"
    VGEN_EXEC="$VGEN_EXEC/invalidvecgen" ;;
    esac
    #how to divide the vectors into groups?
    GROUPING_EXEC="$DECKARD_DIR/src/vgen/vgrouping/runvectorsort"
    #where is the lsh for vector clustering/querying?
    CLUSTER_EXEC="$DECKARD_DIR/src/lsh/bin/enumBuckets"
    QUERY_EXEC="$DECKARD_DIR/src/lsh/bin/queryBuckets"
    #how to post process clone groups?
    POSTPRO_EXEC="$DECKARD_DIR/scripts/clonedetect/post_process_groupfile"
    #how to transform source code html? Used by Deckard1 only
    SRC2HTM_EXEC=source-highlight
    SRC2HTM_OPTS=--line-number-ref

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

  • Version Unknown. Missing README.
    Copyright (c) 2007-2018. University of California / Singapore Management University
    Distributed under the three-clause BSD license.

==== 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
Copy link
Author

lyeeer commented Aug 8, 2019

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
Copy link
Author

lyeeer commented Aug 9, 2019

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)

@lyeeer lyeeer closed this as completed Aug 9, 2019
@Xiaoven
Copy link

Xiaoven commented Mar 25, 2024

#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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants