From patchwork Tue Jul 12 11:39:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Marek X-Patchwork-Id: 968132 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6CBduu0001431 for ; Tue, 12 Jul 2011 11:39:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753211Ab1GLLjz (ORCPT ); Tue, 12 Jul 2011 07:39:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:40465 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752964Ab1GLLjz (ORCPT ); Tue, 12 Jul 2011 07:39:55 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 56CE98A908; Tue, 12 Jul 2011 13:39:54 +0200 (CEST) Received: by sepie.suse.cz (Postfix, from userid 10020) id BC7AE76455; Tue, 12 Jul 2011 13:39:53 +0200 (CEST) From: Michal Marek To: Christian Kujau Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH] kbuild: Do not write to builddir in modules_install Date: Tue, 12 Jul 2011 13:39:40 +0200 Message-Id: <1310470780-12330-1-git-send-email-mmarek@suse.cz> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: References: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 12 Jul 2011 11:39:56 +0000 (UTC) Let depmod.sh create a temporary directory in /tmp instead of writing to the build directory as root. The mktemp utility should be available on any recent system (and there is already scripts/gen_initramfs_list.sh relying on it). Reported-by: Christian Kujau Signed-off-by: Michal Marek --- scripts/depmod.sh | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/depmod.sh b/scripts/depmod.sh index 3b029cb..a272356 100755 --- a/scripts/depmod.sh +++ b/scripts/depmod.sh @@ -21,13 +21,15 @@ fi # older versions of depmod require the version string to start with three # numbers, so we cheat with a symlink here depmod_hack_needed=true -mkdir -p .tmp_depmod/lib/modules/$KERNELRELEASE -if "$DEPMOD" -b .tmp_depmod $KERNELRELEASE 2>/dev/null; then - if test -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep -o \ - -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep.bin; then +tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX) +mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE" +if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then + if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \ + -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then depmod_hack_needed=false fi fi +rm -rf "$tmp_dir" if $depmod_hack_needed; then symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE" ln -s "$KERNELRELEASE" "$symlink"