Print this page
11506 smatch resync

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_scripts/kpatch.sh
          +++ new/usr/src/tools/smatch/src/smatch_scripts/kpatch.sh
   1    1  #!/bin/bash -e
   2    2  
   3    3  TMP_DIR=/tmp
   4    4  
   5    5  help()
   6    6  {
   7      -    echo "Usage: $0 [--no-compile|--ammend] <filename>"
        7 +    echo "Usage: $0 [--no-compile|--amend] <filename>"
   8    8      echo "You must be at the base of the kernel tree to run this."
   9    9      exit 1
  10   10  }
  11   11  
  12   12  continue_yn()
  13   13  {
  14   14      echo -n "Do you want to fix these issues now? "
  15   15      read ans
  16   16      if ! echo $ans | grep -iq ^n ; then
  17   17          exit 1;
↓ open down ↓ 12 lines elided ↑ open up ↑
  30   30      fi
  31   31  }
  32   32  
  33   33  NO_COMPILE=false
  34   34  AMEND=""
  35   35  
  36   36  while true ; do
  37   37      if [[ "$1" == "--no-compile" ]] ; then
  38   38          NO_COMPILE=true
  39   39          shift
  40      -    elif [[ "$1" == "--ammend" ]] ; then
       40 +    elif [[ "$1" == "--amend" ]] ; then
  41   41          AMEND="--amend"
  42   42          shift
  43   43      else
  44   44          break
  45   45      fi
  46   46  done
  47   47  
  48   48  if [ ! -f $1 ] ; then
  49   49      help
  50   50  fi
  51   51  
  52   52  fullname=$1
  53   53  filename=$(basename $fullname)
  54   54  oname=$(echo ${fullname/.c/.o})
  55   55  
  56      -MAIL_FILE=$TMP_DIR/${filename}.msg
       56 +MSG_FILE=$TMP_DIR/${filename}.msg
       57 +MAIL_FILE=$TMP_DIR/${filename}.mail
  57   58  
       59 +# heat up the disk cache
       60 +#git log --oneline $fullname | head -n 10 > /dev/null &
       61 +
  58   62  echo "QC checklist"
  59   63  qc "Have you handled all the errors properly?"
  60   64  if git diff $fullname | grep ^+ | grep -qi alloc ; then
  61   65      qc "Have you freed all your mallocs?"
  62   66  fi
  63   67  if git diff $fullname | grep ^+ | grep -qi alloc ; then
  64   68      qc "Have you check all your mallocs for NULL returns?"
  65   69  fi
  66   70  
  67   71  if [ "$NO_COMPILE" != "true" ] ; then
  68   72      kchecker --spammy $fullname
  69   73      kchecker --sparse --endian $fullname
  70   74  #    rm $oname
  71   75  #    make C=1 CHECK="scripts/coccicheck" $oname
  72   76  fi
  73   77  
  74      -grepmail $fullname ~/var/mail/sent* | grep -i ^subject || echo -n ""
       78 +for file in $(grep -l $fullname ~/var/mail/sent-*) ; do
       79 +    grepmail $fullname $file | grep -i ^subject || echo -n ""
       80 +done
  75   81  qc "Looks OK?"
  76   82  
  77      -git log --oneline $fullname | head -n 10
  78      -echo "Copy and paste one of these subjects?"
  79      -read unused
  80      -
  81   83  git add $fullname
  82      -git commit --signoff $AMEND
  83   84  
       85 +cat /dev/null > $MSG_FILE
       86 +if [ "$AMEND" != "" ] ; then
       87 +    git format-patch HEAD^ --stdout >> $MSG_FILE
       88 +else
       89 +    echo "" >> $MSG_FILE
       90 +    echo "Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>" >> $MSG_FILE
       91 +    echo "" >> $MSG_FILE
       92 +    echo "# $sm_err" >> $MSG_FILE
       93 +fi
       94 +git log -10 --oneline $fullname | sed -e 's/^/# /' >> $MSG_FILE
       95 +vim $MSG_FILE
       96 +
       97 +grep -v '^#' $MSG_FILE > $MSG_FILE.1
       98 +mv $MSG_FILE.1 $MSG_FILE
       99 +
      100 +git commit $AMEND -F $MSG_FILE
      101 +
  84  102  to_addr=$(./scripts/get_maintainer.pl -f --noroles --norolestats $fullname | head -n 1)
  85  103  cc_addr=$(./scripts/get_maintainer.pl -f --noroles --norolestats $fullname | tail -n +2 | \
  86  104      perl -ne 's/\n$/, /; print')
  87  105  cc_addr="$cc_addr, kernel-janitors@vger.kernel.org"
  88  106  
  89  107  echo -n "To:  "  > $MAIL_FILE
  90  108  echo "$to_addr" >> $MAIL_FILE
  91  109  echo -n "CC:  " >> $MAIL_FILE
  92  110  echo "$cc_addr" >> $MAIL_FILE
  93  111  echo "X-Mailer: git-send-email haha only kidding" >> $MAIL_FILE
  94  112  
  95  113  git format-patch HEAD^ --stdout >> $MAIL_FILE
  96  114  
  97  115  ./scripts/checkpatch.pl $MAIL_FILE || continue_yn
  98  116  
  99  117  echo "Press ENTER to continue"
 100  118  read unused
 101  119  
 102  120  mutt -H $MAIL_FILE
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX