From patchwork Thu May 3 11:46:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 10377879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8C64860159 for ; Thu, 3 May 2018 11:47:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E074290AB for ; Thu, 3 May 2018 11:47:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6289E290AF; Thu, 3 May 2018 11:47:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6A02290AB for ; Thu, 3 May 2018 11:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751307AbeECLrU (ORCPT ); Thu, 3 May 2018 07:47:20 -0400 Received: from mail-lf0-f51.google.com ([209.85.215.51]:42058 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751004AbeECLrS (ORCPT ); Thu, 3 May 2018 07:47:18 -0400 Received: by mail-lf0-f51.google.com with SMTP id u21-v6so25500489lfu.9 for ; Thu, 03 May 2018 04:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=XxDeu4D+cuDOMw4WAEeMi6AfFalw0DuUPsNurfVE4ck=; b=f0OIQFqe/Bo1KQnPHFkLKirBKNQrHuzGkYiK+c5yv/Gkz99nBW4tZQLLXzXOB+mY+/ KSOB85pV3psAzr73m3DwM/qioIcKkfZIfOgAqChtdaUkKUtO52Lrr/oLLJzBbXLTsdnF CPEDxjzefDFomfoIiqGbv2XLY9F2Rjb51JkH0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XxDeu4D+cuDOMw4WAEeMi6AfFalw0DuUPsNurfVE4ck=; b=A1HWK4wtR+N1uTN9Wjg6ye7kXntkkXE+DWb5z1MJd/XRbGTUuaoI1Ecm9WczK0PQwQ NVQm+9I0ifyPb6qkxePoja9rRmOuZRBJ+vQ+orJV9TL7h5oSmDgLKrodFBBZtWFj1PB2 P7s3+PfuSwRqNqslajeJw3C6lmz0frZtpGZTjsno7SuTW/i6DKjHxwAkYgAexw3C/Y2p QRq8xHCnEVAje0GopABcDzh0w3STgf/j33x03rD5ukeSDkpVHapuiIpE+8E0yc4zcqGu tgv/XtVOJv8rTHEBRemt7ptTkjs29OirRqT86PGzbyKBDfQI8Fjm7/lkkszoDziFZvzH 8WVA== X-Gm-Message-State: ALQs6tAvpZ1oR14Iqu+mz8Ln6Bt6ssmr3eHv648I4vt6Iwj83nAcBaVT pH8DF0HwsESG+AhNQBETBm3plxyWP3w= X-Google-Smtp-Source: AB8JxZqiO7YVN1wo2VCPu84pkG/UaDZgfQT1Db9Ol0YogjqKp+Qv0oT9qE9jEeIs057jBvtwXSV4oA== X-Received: by 2002:a19:3848:: with SMTP id d8-v6mr12419433lfj.16.1525348036052; Thu, 03 May 2018 04:47:16 -0700 (PDT) Received: from beaming.home (91-154-20-92.elisa-laajakaista.fi. [91.154.20.92]) by smtp.gmail.com with ESMTPSA id q77-v6sm2820557lfd.96.2018.05.03.04.47.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 04:47:14 -0700 (PDT) From: riku.voipio@linaro.org To: linux-kbuild@vger.kernel.org, Masahiro Yamada Cc: debian-kernel@lists.debian.org, malat@debian.org, Riku Voipio Subject: [PATCH] kbuild: deb-pkg improve maintainer address generation Date: Thu, 3 May 2018 14:46:27 +0300 Message-Id: <20180503114627.30183-1-riku.voipio@linaro.org> X-Mailer: git-send-email 2.14.2 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Riku Voipio There is multiple issues with the genaration of maintainer string It uses DEBEMAIL and EMAIL enviroment variables, which may contain angle brackets, creating invalid maintainer strings. The documented KBUILD_BUILD_USER and KBUILD_BUILD_HOST variables are not used. Undocumented and uncommon NAME variable is used. Refactor the Maintainer string to: - use EMAIL or DEBEMAIL directly if they are in form "name " - use KBUILD_BUILD_USER and KBUILD_BUILD_HOST if set before falling back to autodetection - no longer use NAME variable or the useless Anonymous string The logic is switched from multiline if/then/fi statements to compact shell variable substition commands. Reported-by: Mathieu Malaterre Signed-off-by: Riku Voipio Acked-by: Mathieu Malaterre --- scripts/package/mkdebian | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index 6adb3a16ba3b..a70f20eb877a 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -71,22 +71,23 @@ if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi -# Try to determine maintainer and email values -if [ -n "$DEBEMAIL" ]; then - email=$DEBEMAIL -elif [ -n "$EMAIL" ]; then - email=$EMAIL -else - email=$(id -nu)@$(hostname -f 2>/dev/null || hostname) -fi -if [ -n "$DEBFULLNAME" ]; then - name=$DEBFULLNAME -elif [ -n "$NAME" ]; then - name=$NAME +email=${DEBEMAIL-$EMAIL} + +# use email string directly if it contains +if echo $email|grep -q '<.*>'; +then + maintainer=$email else - name="Anonymous" + # or construct the maintainer string + user=${KBUILD_BUILD_USER-$(id -nu)} + name=${DEBFULLNAME-$user} + if [ -n "$email" ]; then + maintainer="$name <$email>" + else + buildhost=${KBUILD_BUILD_HOST-$(hostname -f 2>/dev/null || hostname)} + maintainer="$name <$user@$buildhost>" + fi fi -maintainer="$name <$email>" # Try to determine distribution if [ -n "$KDEB_CHANGELOG_DIST" ]; then