Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp2925954imc; Sat, 23 Feb 2019 14:57:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IY/0zIO49WRTLYYt+NtE8g84Shkcj8nAmkt2HcQHCyN9QG6s2e8BT9TxFUhI2f+uXoRoi+R X-Received: by 2002:a63:814a:: with SMTP id t71mr10761705pgd.257.1550962649475; Sat, 23 Feb 2019 14:57:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550962649; cv=none; d=google.com; s=arc-20160816; b=WEPDc0+V7pg7Ii93DJkWEnw54lLXBQcgXe0xXCW9SaH4/lIkCbcMdtBlYC/e8RjkDu dxsIusu+SbZeE4im/cJyaPC92A1HnXVkpF+b1ePKjb0/oJtsSE2FJKM1GMMV0cmBe2ah ay1Fj00ArOW3s2PNLUsaez8Nl1PtfRuY50ryuriul1yBdMX9DJjrO1xfxcARuPR801h1 UhC+kSOBxH6s54Gvh45v2w0FPSJEtcVsAPamnSDwjPzZXrmrwWB0LSbsotSLV1ejCXAl yrU2pbx0J/L9vlhWJzXEzEEJHWxW2yWc0nXHD1XesfPHO9OK8qWPhj4CqM8UhMTwZ8+/ f0rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=WRZ+YLpaJhOOMTgJey/CIxgNlTnyFodsLoXJMTB5v3k=; b=zGnHX9DnOoTIScH8rnuUNFYqRtKXJMlD+ave92HKAn9jt8JFPuewmq+gV7kd9ey3h3 PasBGyAV5EkVTr/jqgy2HOFtBJ9Z97okVVxzcqLuxgnEXy7gP41lNvcDCAdDyj5os1i1 Ak3Zve5U0O+IX1MacDk+puHk8QiDSba2dOyatf2yL6BEf155X1QBmP46MX/wJgW8Ilsw VNabeYj+MUPTNsZvPa4KRUmkoueukE7BigPyeZaNAtI2xZSGxLdVCH+WLRODxC2qTutr VTtEfUfPYnHIkG1e2MsP5z3KnHyoML4aM+nWiCudE6uIKRBdNV6930qeGkGaznvxfVNp k7iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=EenS39JB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j70si4740157pge.271.2019.02.23.14.57.11; Sat, 23 Feb 2019 14:57:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=EenS39JB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727913AbfBWW4u (ORCPT + 99 others); Sat, 23 Feb 2019 17:56:50 -0500 Received: from ozlabs.org ([203.11.71.1]:35419 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbfBWW4u (ORCPT ); Sat, 23 Feb 2019 17:56:50 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 446Nqx5q8nz9sBR; Sun, 24 Feb 2019 09:56:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1550962605; bh=mwfKAMZ1LWxIOBXvl+QzaZFC2+snnDEH4puz8GSTXWs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EenS39JBLUoaphDdsgkz0WfCDXt12dQaSRLLMqoT5dPwV4NXqe4W2QZkm0FJsSXdp D08M4lxw3C5zfrU1h3thxpvfceMym7uXl3BQ5hn2GGi7nbN4SFAo2DbbwQVRU62b7c UsX1pokOn2tRkNLNq8UN2gBW0bgrs2g5aUAgC4XbhWAF840anaUpV+b+jFo+QUPsMb J5V9pK7OiYgcIHB4F38PLkbaxAI64XJ2LxDUo+32hIKTqjog7wo4Tk5lYGrGH7Bp6K LxVFKc5+iyu1sZLrRKEJFxSUJB5MfyOKqUCbnTyMl8wnZPaKh6w8riqZAUiIC85AQ7 row+73MiV/DQQ== Date: Sun, 24 Feb 2019 09:56:42 +1100 From: Stephen Rothwell To: Darren Hart Cc: Andy Shevchenko , Linux Next Mailing List , Linux Kernel Mailing List Subject: Re: linux-next: Signed-off-by missing for commit in the drivers-x86 tree Message-ID: <20190224095642.523fdea2@canb.auug.org.au> In-Reply-To: <20190223175207.GC4722@wrath> References: <20190224011925.6db87446@canb.auug.org.au> <20190223175207.GC4722@wrath> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/KZhyBNQ/hZFVW+d997iRVY2"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/KZhyBNQ/hZFVW+d997iRVY2 Content-Type: multipart/mixed; boundary="MP_/0H667QLdNnEQjQ8aWJ5J6DA" --MP_/0H667QLdNnEQjQ8aWJ5J6DA Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Darren, On Sat, 23 Feb 2019 09:52:07 -0800 Darren Hart wrote: > > Apologies if I've asked you this before... I didn't find it after some > searching. >=20 > We should be catching errors like this before they hit next. First, > there is no reason we can't catch them - unlike the integration failures > only next can catch. Second, once they are in next, there is no "right" > way to fix them. Either rebase or send the bad patch to mainline - both > are bad. Don't get me wrong, I'm glad next catches them.... but I'd like > to get to the point where it doesn't trigger on our subsystem :-) >=20 > Are your patch mechanics tests available for us to integrate into our > commit and prepublication checks? I have attached the current version of my check scripts (I can't use git hooks since I want to do these checks when I fetch trees). They both take a range of commits (I usually pass "^origin/master ..." (only 2 dots if the branch is just fast forwarded). These could obviously be simplified because they also generate most of the appropriate mail messages ... --=20 Cheers, Stephen Rothwell --MP_/0H667QLdNnEQjQ8aWJ5J6DA Content-Type: application/x-shellscript Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=check_fixes #!/bin/bash if [ "$#" -lt 1 ]; then printf 'Usage: %s \n', "$0" 1>&2 exit 1 fi commits=3D$(git rev-list --no-merges -i --grep=3D'^[[:space:]]*Fixes:' "$@") if [ -z "$commits" ]; then exit 0 fi # This should be a git tree that contains *only* Linus' tree Linus_tree=3D"${HOME}/kernels/linus.git" split_re=3D'^([Cc][Oo][Mm][Mm][Ii][Tt])?[[:space:]]*([[:xdigit:]]{5,})([[:s= pace:]]*)(.*)$' nl=3D$'\n' tab=3D$'\t' # Strip the leading and training spaces from a string strip_spaces() { [[ "$1" =3D~ ^[[:space:]]*(.*[^[:space:]])[[:space:]]*$ ]] echo "${BASH_REMATCH[1]}" } for c in $commits; do commit_log=3D$(git log -1 --format=3D'%h ("%s")' "$c") commit_msg=3D"In commit $commit_log " fixes_lines=3D$(git log -1 --format=3D'%B' "$c" | grep -i '^[[:space:]]*Fixes:') while read -r fline; do [[ "$fline" =3D~ ^[[:space:]]*[Ff][Ii][Xx][Ee][Ss]:[[:space:]]*(.*)$ ]] f=3D"${BASH_REMATCH[1]}" fixes_msg=3D"Fixes tag $fline has these problem(s): " sha=3D subject=3D msg=3D if [[ "$f" =3D~ $split_re ]]; then first=3D"${BASH_REMATCH[1]}" sha=3D"${BASH_REMATCH[2]}" spaces=3D"${BASH_REMATCH[3]}" subject=3D"${BASH_REMATCH[4]}" if [ "$first" ]; then msg=3D"${msg:+${msg}${nl}} - leading word '$first' unexpected" fi if [ -z "$subject" ]; then msg=3D"${msg:+${msg}${nl}} - missing subject" elif [ -z "$spaces" ]; then msg=3D"${msg:+${msg}${nl}} - missing space between the SHA1 and the su= bject" fi else printf '%s%s - %s\n' "$commit_msg" "$fixes_msg" 'No SHA1 recognised' commit_msg=3D'' continue fi if ! git rev-parse -q --verify "$sha" >/dev/null; then printf '%s%s - %s\n' "$commit_msg" "$fixes_msg" 'Target SHA1 does not e= xist' commit_msg=3D'' continue fi if [ "${#sha}" -lt 12 ]; then msg=3D"${msg:+${msg}${nl}} - SHA1 should be at least 12 digits long${nl= } Can be fixed by setting core.abbrev to 12 (or more) or (for git v2.11$= {nl} or later) just making sure it is not set (or set to \"auto\")." fi # reduce the subject to the part between () if there if [[ "$subject" =3D~ ^\((.*)\) ]]; then subject=3D"${BASH_REMATCH[1]}" elif [[ "$subject" =3D~ ^\((.*) ]]; then subject=3D"${BASH_REMATCH[1]}" msg=3D"${msg:+${msg}${nl}} - Subject has leading but no trailing parent= heses" fi # strip matching quotes at the start and end of the subject # the unicode characters in the classes are # U+201C LEFT DOUBLE QUOTATION MARK # U+201D RIGHT DOUBLE QUOTATION MARK # U+2018 LEFT SINGLE QUOTATION MARK # U+2019 RIGHT SINGLE QUOTATION MARK re1=3D$'^[\"\u201C](.*)[\"\u201D]$' re2=3D$'^[\'\u2018](.*)[\'\u2019]$' re3=3D$'^[\"\'\u201C\u2018](.*)$' if [[ "$subject" =3D~ $re1 ]]; then subject=3D"${BASH_REMATCH[1]}" elif [[ "$subject" =3D~ $re2 ]]; then subject=3D"${BASH_REMATCH[1]}" elif [[ "$subject" =3D~ $re3 ]]; then subject=3D"${BASH_REMATCH[1]}" msg=3D"${msg:+${msg}${nl}} - Subject has leading but no trailing quotes" fi subject=3D$(strip_spaces "$subject") target_subject=3D$(git log -1 --format=3D'%s' "$sha") target_subject=3D$(strip_spaces "$target_subject") # match with ellipses case "$subject" in *...) subject=3D"${subject%...}" target_subject=3D"${target_subject:0:${#subject}}" ;; ...*) subject=3D"${subject#...}" target_subject=3D"${target_subject: -${#subject}}" ;; *\ ...\ *) s1=3D"${subject% ... *}" s2=3D"${subject#* ... }" subject=3D"$s1 $s2" t1=3D"${target_subject:0:${#s1}}" t2=3D"${target_subject: -${#s2}}" target_subject=3D"$t1 $t2" ;; esac subject=3D$(strip_spaces "$subject") target_subject=3D$(strip_spaces "$target_subject") if [ "$subject" !=3D "${target_subject:0:${#subject}}" ]; then msg=3D"${msg:+${msg}${nl}} - Subject does not match target commit subje= ct${nl} Just use${nl}${tab}git log -1 --format=3D'Fixes: %h ("%s")'" fi lsha=3D$(cd "$Linus_tree" && git rev-parse -q --verify "$sha") if [ -z "$lsha" ]; then count=3D$(git rev-list --count "$sha".."$c") if [ "$count" -eq 0 ]; then msg=3D"${msg:+${msg}${nl}} - Target is not an ancestor of this commit" fi fi if [ "$msg" ]; then printf '%s%s%s\n' "$commit_msg" "$fixes_msg" "$msg" commit_msg=3D'' fi done <<< "$fixes_lines" done exit 0 --MP_/0H667QLdNnEQjQ8aWJ5J6DA Content-Type: application/x-shellscript Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=check_commits #!/bin/bash if [ "$#" -lt 1 ]; then printf "Usage: %s \n", "$0" 1>&2 exit 1 fi commits=3D$(git rev-list --no-merges "$@") if [ -z "$commits" ]; then printf "No commits\n" exit 0 fi author_missing=3D committer_missing=3D print_commits() { local t=3D"$1" shift s=3D is=3D'is' its=3D'its' [ "$#" -gt 1 ] && { s=3D's' is=3D'are' its=3D'their' } printf "Commit%s\n\n" "$s" git log --no-walk --pretty=3D'format: %h ("%s")' "$@" printf "\n%s missing a Signed-off-by from %s %s%s.\n" "$is" "$its" "$t" "$= s" printf "\n" } for c in $commits; do ae=3D$(git log -1 --format=3D'<%ae>%n<%aE>%n %an %n %aN ' "$c" | sort -u) ce=3D$(git log -1 --format=3D'<%ce>%n<%cE>%n %cn %n %cN ' "$c" | sort -u) msg=3D$(git log -1 --format=3D'%b' "$c") sob=3D$(echo "$msg" | sed -En 's/^\s*Signed-off-by:?\s*/ /ip') am=3Dfalse cm=3Dfalse grep -i -F -q "$ae" <<<"$sob" || am=3Dtrue grep -i -F -q "$ce" <<<"$sob" || cm=3Dtrue "$am" && author_missing+=3D" $c" "$cm" && committer_missing+=3D" $c" done if [ "$author_missing" ]; then print_commits "author" $author_missing fi if [ "$committer_missing" ]; then print_commits "committer" $committer_missing fi exec gitk "$@" --MP_/0H667QLdNnEQjQ8aWJ5J6DA-- --Sig_/KZhyBNQ/hZFVW+d997iRVY2 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAlxxz6oACgkQAVBC80lX 0GzVhQf9EblIScdRfVoaSUuM3G2+o5a6sSy85QwWrwbEbp2fsAE4Pumrfb8GGHsa RQwFQvOLUcfCczXHphpjhcSZBhd4I7VlBqdyiOOeiIeoow2CQp8kzGyqAzMYQyIB nldbwUg9z8UX0WPsnYw0Vrcak6G98MRJOunB4+5Rv3lwhG60IKwdgqnt+C7thpfu I9bMuIrAG10ac+RFSWMiG3FqDctbL1DbKVSkx5gRE5XnZkcPoGF+jyRxvZCLOpwO Vtpoxgwj68VgCJRKwW7cc6ffKIC6cdu3xrNnBPYpjc+60CWSkgPED24kkKf1DcZ2 HqxKeZ/+jfWy9EbfB/LHgLZ7YCgphA== =qbN8 -----END PGP SIGNATURE----- --Sig_/KZhyBNQ/hZFVW+d997iRVY2--