~ubuntu-branches/ubuntu/utopic/gridengine/utopic

« back to all changes in this revision

Viewing changes to source/scripts/gelint

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2008-06-25 22:36:13 UTC
  • Revision ID: james.westby@ubuntu.com-20080625223613-tvd9xlhuoct9kyhm
Tags: upstream-6.2~beta2
ImportĀ upstreamĀ versionĀ 6.2~beta2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
exec 2>&1
 
3
 
 
4
if [ $# -lt 2 ]; then
 
5
   echo "Usage: gelint <gridengine dir> file(s)"
 
6
   exit 1
 
7
fi
 
8
 
 
9
GE=$1
 
10
 
 
11
if [ ! -d "$GE/source" -a ! -f "$GE/Changelog" ]; then
 
12
   echo "$GE is not a gridengine source directory!"
 
13
   echo "$GE/Changelog and $GE/source are missing!"
 
14
   exit 1
 
15
fi
 
16
 
 
17
shift
 
18
cd $GE/source
 
19
 
 
20
ERRSECLEVEL=core        #core security checks printf scanf only
 
21
#ERRSECLEVEL=standard    #standard is core plus strlcpy and so on
 
22
#ERRSECLEVEL=extended    #extended is standard plus getc fgetc, full exec command family, path race conditions,
 
23
                        #reviewing code determining security issues
 
24
 
 
25
IGNORE_ERRS="
 
26
 E_EXPR_NULL_EFFECT
 
27
 E_FUNC_ARG_UNUSED
 
28
 E_FUNC_RET_ALWAYS_IGNOR2
 
29
 E_FUNC_RET_MAYBE_IGNORED2
 
30
 E_NAME_DECL_NOT_USED_DEF2
 
31
 E_NAME_DEF_NOT_USED2
 
32
 E_NAME_USED_NOT_DEF2
 
33
 E_NOP_IF_STMT
 
34
 E_CONST_EXPR
 
35
 E_ASSIGMENT_CAUSE_LOSS_PREC
 
36
 E_NOP_ELSE_STMT
 
37
 E_SEC_PRINTF_VAR_FMT
 
38
 E_EQUALITY_NOT_ASSIGNMENT
 
39
 E_SLASH_STAR_IN_CMNT
 
40
 E_UNDEFINED_SYMBOL
 
41
 E_INDISTING_FROM_TRUNC2
 
42
 E_FUNC_DECL_VAR_ARG2
 
43
 E_INCONS_ARG_DECL2
 
44
 E_INCONS_VAL_TYPE_DECL2
 
45
"
 
46
 
 
47
for err in $IGNORE_ERRS
 
48
do
 
49
  ERRIGNORE="$ERRIGNORE -erroff=$err"
 
50
done
 
51
 
 
52
INC_FLAGS=`cd $GE/source; ./aimk -flags | grep INCLUDES | cut -d: -f2 | sed -e s?"\.\."?"$GE/source"?g`
 
53
C_FLAGS=`cd $GE/source; ./aimk -flags | grep CFLAGS | cut -d: -f2 | sed -e s/"-xarch"/"-Xarch"/g | sed -e s/"-xchip=generic -xcache=generic"//g | sed -e s/"-fast"//g`
 
54
 
 
55
ADDITIONAL_INCLUDES=" -I/usr/include/rpc/"
 
56
 
 
57
exec lint \
 
58
    -s \
 
59
    $INC_FLAGS \
 
60
    $ADDITIONAL_INCLUDES \
 
61
    $C_FLAGS \
 
62
    -errtags=yes \
 
63
    -errsecurity=$ERRSECLEVEL \
 
64
    $ERRIGNORE \
 
65
    "$@"
 
66
 
 
67
exit 1 
 
68