Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A955C282CE for ; Wed, 22 May 2019 15:03:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3265620879 for ; Wed, 22 May 2019 15:03:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3265620879 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([127.0.0.1]:45570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTSmF-00049L-D9 for qemu-devel@archiver.kernel.org; Wed, 22 May 2019 11:03:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTSkg-0003Qs-RX for qemu-devel@nongnu.org; Wed, 22 May 2019 11:02:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTSkf-0003Gh-Jx for qemu-devel@nongnu.org; Wed, 22 May 2019 11:01:58 -0400 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]:51980) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTSkf-00039V-EH; Wed, 22 May 2019 11:01:57 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ao2) with ESMTPSA id 6944F28009A To: Laurent Vivier , Peter Maydell , Eric Blake References: <20190503082728.16485-1-ao2@ao2.it> <20190503082728.16485-3-ao2@ao2.it> <541bfc5c-0e45-58e6-f0b1-81e9b0c8881d@redhat.com> From: Antonio Ospite Message-ID: <9349da74-b4a1-932d-227a-a63df1bb63a5@collabora.com> Date: Wed, 22 May 2019 17:01:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1098:0:82:1000:25:2eeb:e3e3 Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 2/2] configure: disallow spaces and colons in source path and build path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Trivial , Antonio Ospite , QEMU Developers Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 22/05/19 15:57, Laurent Vivier wrote: > On 09/05/2019 16:42, Peter Maydell wrote: >> On Mon, 6 May 2019 at 18:27, Eric Blake wrote: >>> >>> On 5/3/19 3:27 AM, Antonio Ospite wrote: >>>> From: Antonio Ospite >>>> >>>> The configure script breaks when the qemu source directory is in a p= ath >>>> containing white spaces, in particular the list of targets is not >>>> correctly generated when calling "./configure --help" because of how= =20 >>>> the >>>> default_target_list variable is built. >>>> >>>> In addition to that, *building* qemu from a directory with spaces=20 >>>> breaks >>>> some assumptions in the Makefiles, even if the original source path=20 >>>> does >>>> not contain spaces like in the case of an out-of-tree build, or when >>>> symlinks are involved. >>>> >>>> To avoid these issues, refuse to run the configure script and the >>>> Makefile if there are spaces or colons in the source path or the bui= ld >>>> path, taking as inspiration what the kbuild system in linux does. >>>> >>>> Buglink: https://bugs.launchpad.net/qemu/+bug/1817345 >>>> >>>> Signed-off-by: Antonio Ospite >>>> --- >>>> =C2=A0 Makefile=C2=A0 | 4 ++++ >>>> =C2=A0 configure | 6 ++++++ >>>> =C2=A0 2 files changed, 10 insertions(+) >>>> >>> >>>> +++ b/Makefile >>>> @@ -1,5 +1,9 @@ >>>> =C2=A0 # Makefile for QEMU. >>>> >>>> +ifneq ($(words $(subst :, ,$(CURDIR))), 1) >>>> +=C2=A0 $(error main directory cannot contain spaces nor colons) >>>> +endif >>>> + >>>> =C2=A0 # Always point to the root of the build tree (needs GNU make)= . >>>> =C2=A0 BUILD_DIR=3D$(CURDIR) >>>> >>>> diff --git a/configure b/configure >>>> index 9832cbca5c..f7ad4381bd 100755 >>>> --- a/configure >>>> +++ b/configure >>>> @@ -279,6 +279,12 @@ ld_has() { >>>> =C2=A0 # make source path absolute >>>> =C2=A0 source_path=3D$(cd "$(dirname -- "$0")"; pwd) >>>> >>>> +if printf "%s\n" "$source_path" | grep -q "[[:space:]:]" || >>>> +=C2=A0 printf "%s\n" "$PWD" | grep -q "[[:space:]:]"; >>> >>> For less typing and fewer processes, you could shorten this to: >>> >>> if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; >>> >>> but that's trivial enough for a maintainer to fold in if desired. >>> >>> Reviewed-by: Eric Blake >> >> What tree is this going to go in via? I suggest the >> -trivial tree. >=20 >=20 > Applied (unchanged) to my trivial-patches branch. >=20 Thank you Laurent. I'll think about sending a followup patch with the changes proposed by=20 Eric and I'll CC you if I do. Ciao, Antonio