qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path
@ 2019-05-26 14:47 Antonio Ospite
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust Antonio Ospite
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Antonio Ospite @ 2019-05-26 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Antonio Ospite, Antonio Ospite, Laurent Vivier

Hi,

Here is a v3 set to address
https://bugs.launchpad.net/qemu/+bug/1817345

CCing Laurent Vivier as the patch is going through the trivial-patches
branch.

The series follows up to:
https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg00562.html

Changes since v2:
  - Shorten 'if' check as suggested by Eric Blake in
    https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg01190.html

  - Added Reviewed-by tags by Eric Blake.


Changes since v1:
  - Add a preparatory patch to set source_path only once and in a more
    robust way.

  - Move the checks in configure after the source_path definition to
    avoid using realpath which is not available everywhere.

  - Cover also the build path in Makefile. An extensive explanation of
    why I think this is needed is here:
    https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg05398.html

Thank you,
   Antonio


Antonio Ospite (2):
  configure: set source_path only once and make its definition more
    robust
  configure: disallow spaces and colons in source path and build path

 Makefile  |  4 ++++
 configure | 11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust
  2019-05-26 14:47 [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
@ 2019-05-26 14:47 ` Antonio Ospite
  2019-06-26 15:56   ` Laurent Vivier
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 2/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
  2019-06-26 15:16 ` [Qemu-devel] [PATCH v3 0/2] " Antonio Ospite
  2 siblings, 1 reply; 9+ messages in thread
From: Antonio Ospite @ 2019-05-26 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Antonio Ospite, Laurent Vivier

From: Antonio Ospite <antonio.ospite@collabora.com>

Since commit 79d77bcd36 (configure: Remove --source-path option,
2019-04-29) source_path cannot be overridden anymore, move it out of the
"default parameters" block since the word "default" may suggest that the
value can change, while in fact it does not.

While at it, only set source_path once and separate the positional
argument of basename with "--" to more robustly cover the case of path
names starting with a dash.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
---
 configure | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 528b9ff705..9f12120ad9 100755
--- a/configure
+++ b/configure
@@ -276,10 +276,10 @@ ld_has() {
     $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
 }
 
-# default parameters
-source_path=$(dirname "$0")
 # make source path absolute
-source_path=$(cd "$source_path"; pwd)
+source_path=$(cd "$(dirname -- "$0")"; pwd)
+
+# default parameters
 cpu=""
 iasl="iasl"
 interp_prefix="/usr/gnemul/qemu-%M"
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH v3 2/2] configure: disallow spaces and colons in source path and build path
  2019-05-26 14:47 [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust Antonio Ospite
@ 2019-05-26 14:47 ` Antonio Ospite
  2019-06-26 15:56   ` Laurent Vivier
  2019-06-26 15:16 ` [Qemu-devel] [PATCH v3 0/2] " Antonio Ospite
  2 siblings, 1 reply; 9+ messages in thread
From: Antonio Ospite @ 2019-05-26 14:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Antonio Ospite, Laurent Vivier

From: Antonio Ospite <antonio.ospite@collabora.com>

The configure script breaks when the qemu source directory is in a path
containing white spaces, in particular the list of targets is not
correctly generated when calling "./configure --help" because of how the
default_target_list variable is built.

In addition to that, *building* qemu from a directory with spaces breaks
some assumptions in the Makefiles, even if the original source path 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 build
path, taking as inspiration what the kbuild system in linux does.

Buglink: https://bugs.launchpad.net/qemu/+bug/1817345

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
---
 Makefile  | 4 ++++
 configure | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/Makefile b/Makefile
index e02b88bcb1..bed1323a45 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,9 @@
 # Makefile for QEMU.
 
+ifneq ($(words $(subst :, ,$(CURDIR))), 1)
+  $(error main directory cannot contain spaces nor colons)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
 
diff --git a/configure b/configure
index 9f12120ad9..2833d73ccc 100755
--- a/configure
+++ b/configure
@@ -279,6 +279,11 @@ ld_has() {
 # make source path absolute
 source_path=$(cd "$(dirname -- "$0")"; pwd)
 
+if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
+then
+  error_exit "main directory cannot contain spaces nor colons"
+fi
+
 # default parameters
 cpu=""
 iasl="iasl"
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path
  2019-05-26 14:47 [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust Antonio Ospite
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 2/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
@ 2019-06-26 15:16 ` Antonio Ospite
  2019-06-26 15:50   ` Laurent Vivier
  2019-06-26 15:52   ` Eric Blake
  2 siblings, 2 replies; 9+ messages in thread
From: Antonio Ospite @ 2019-06-26 15:16 UTC (permalink / raw)
  To: Antonio Ospite, qemu-devel; +Cc: Peter Maydell, Laurent Vivier

On 26/05/19 16:47, Antonio Ospite wrote:
> Hi,
> 
> Here is a v3 set to address
> https://bugs.launchpad.net/qemu/+bug/1817345
> 
> CCing Laurent Vivier as the patch is going through the trivial-patches
> branch.
>

Ping.

I cannot see this in the trivial-patches repository nor in mainline qemu.

Thanks,
    Antonio

> The series follows up to:
> https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg00562.html
> 
> Changes since v2:
>    - Shorten 'if' check as suggested by Eric Blake in
>      https://lists.gnu.org/archive/html/qemu-devel/2019-05/msg01190.html
> 
>    - Added Reviewed-by tags by Eric Blake.
> 
> 
> Changes since v1:
>    - Add a preparatory patch to set source_path only once and in a more
>      robust way.
> 
>    - Move the checks in configure after the source_path definition to
>      avoid using realpath which is not available everywhere.
> 
>    - Cover also the build path in Makefile. An extensive explanation of
>      why I think this is needed is here:
>      https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg05398.html
> 
> Thank you,
>     Antonio
> 
> 
> Antonio Ospite (2):
>    configure: set source_path only once and make its definition more
>      robust
>    configure: disallow spaces and colons in source path and build path
> 
>   Makefile  |  4 ++++
>   configure | 11 ++++++++---
>   2 files changed, 12 insertions(+), 3 deletions(-)
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path
  2019-06-26 15:16 ` [Qemu-devel] [PATCH v3 0/2] " Antonio Ospite
@ 2019-06-26 15:50   ` Laurent Vivier
  2019-06-26 15:54     ` Antonio Ospite
  2019-06-26 15:52   ` Eric Blake
  1 sibling, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2019-06-26 15:50 UTC (permalink / raw)
  To: Antonio Ospite, Antonio Ospite, qemu-devel; +Cc: Peter Maydell

Le 26/06/2019 à 17:16, Antonio Ospite a écrit :
> On 26/05/19 16:47, Antonio Ospite wrote:
>> Hi,
>>
>> Here is a v3 set to address
>> https://bugs.launchpad.net/qemu/+bug/1817345
>>
>> CCing Laurent Vivier as the patch is going through the trivial-patches
>> branch.
>>
> 
> Ping.
> 
> I cannot see this in the trivial-patches repository nor in mainline qemu.
> 

I missed it because you didn't cc: qemu-trivial ML (I use this list to
pick up the patches).

I'm going to add them to the next pull request.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path
  2019-06-26 15:16 ` [Qemu-devel] [PATCH v3 0/2] " Antonio Ospite
  2019-06-26 15:50   ` Laurent Vivier
@ 2019-06-26 15:52   ` Eric Blake
  1 sibling, 0 replies; 9+ messages in thread
From: Eric Blake @ 2019-06-26 15:52 UTC (permalink / raw)
  To: Antonio Ospite, Antonio Ospite, qemu-devel
  Cc: qemu-trivial, Peter Maydell, Laurent Vivier


[-- Attachment #1.1: Type: text/plain, Size: 901 bytes --]

On 6/26/19 10:16 AM, Antonio Ospite wrote:
> On 26/05/19 16:47, Antonio Ospite wrote:
>> Hi,
>>
>> Here is a v3 set to address
>> https://bugs.launchpad.net/qemu/+bug/1817345
>>
>> CCing Laurent Vivier as the patch is going through the trivial-patches
>> branch.
>>
> 
> Ping.
> 
> I cannot see this in the trivial-patches repository nor in mainline qemu.
> 

Explicitly adding qemu-trivial in cc may help (done now).

>> Antonio Ospite (2):
>>    configure: set source_path only once and make its definition more
>>      robust
>>    configure: disallow spaces and colons in source path and build path
>>
>>   Makefile  |  4 ++++
>>   configure | 11 ++++++++---
>>   2 files changed, 12 insertions(+), 3 deletions(-)
>>
> 
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path
  2019-06-26 15:50   ` Laurent Vivier
@ 2019-06-26 15:54     ` Antonio Ospite
  0 siblings, 0 replies; 9+ messages in thread
From: Antonio Ospite @ 2019-06-26 15:54 UTC (permalink / raw)
  To: Laurent Vivier, Antonio Ospite, qemu-devel; +Cc: Peter Maydell

On 26/06/19 17:50, Laurent Vivier wrote:
> Le 26/06/2019 à 17:16, Antonio Ospite a écrit :
>> On 26/05/19 16:47, Antonio Ospite wrote:
>>> Hi,
>>>
>>> Here is a v3 set to address
>>> https://bugs.launchpad.net/qemu/+bug/1817345
>>>
>>> CCing Laurent Vivier as the patch is going through the trivial-patches
>>> branch.
>>>
>>
>> Ping.
>>
>> I cannot see this in the trivial-patches repository nor in mainline qemu.
>>
> 
> I missed it because you didn't cc: qemu-trivial ML (I use this list to
> pick up the patches).
>

Ah yes, I had read that on
https://wiki.qemu.org/Contribute/TrivialPatches
but then forgot about it.

> I'm going to add them to the next pull request.
> 
> Thanks,
> Laurent
> 

Thank you,
    Antonio


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust Antonio Ospite
@ 2019-06-26 15:56   ` Laurent Vivier
  0 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2019-06-26 15:56 UTC (permalink / raw)
  To: Antonio Ospite, qemu-devel; +Cc: qemu-trivial, Antonio Ospite

Le 26/05/2019 à 16:47, Antonio Ospite a écrit :
> From: Antonio Ospite <antonio.ospite@collabora.com>
> 
> Since commit 79d77bcd36 (configure: Remove --source-path option,
> 2019-04-29) source_path cannot be overridden anymore, move it out of the
> "default parameters" block since the word "default" may suggest that the
> value can change, while in fact it does not.
> 
> While at it, only set source_path once and separate the positional
> argument of basename with "--" to more robustly cover the case of path
> names starting with a dash.
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
> ---
>  configure | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index 528b9ff705..9f12120ad9 100755
> --- a/configure
> +++ b/configure
> @@ -276,10 +276,10 @@ ld_has() {
>      $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
>  }
>  
> -# default parameters
> -source_path=$(dirname "$0")
>  # make source path absolute
> -source_path=$(cd "$source_path"; pwd)
> +source_path=$(cd "$(dirname -- "$0")"; pwd)
> +
> +# default parameters
>  cpu=""
>  iasl="iasl"
>  interp_prefix="/usr/gnemul/qemu-%M"
> 

Applied to my trivial-patches branch.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v3 2/2] configure: disallow spaces and colons in source path and build path
  2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 2/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
@ 2019-06-26 15:56   ` Laurent Vivier
  0 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2019-06-26 15:56 UTC (permalink / raw)
  To: Antonio Ospite, qemu-devel; +Cc: qemu-trivial, Peter Maydell, Antonio Ospite

Le 26/05/2019 à 16:47, Antonio Ospite a écrit :
> From: Antonio Ospite <antonio.ospite@collabora.com>
> 
> The configure script breaks when the qemu source directory is in a path
> containing white spaces, in particular the list of targets is not
> correctly generated when calling "./configure --help" because of how the
> default_target_list variable is built.
> 
> In addition to that, *building* qemu from a directory with spaces breaks
> some assumptions in the Makefiles, even if the original source path 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 build
> path, taking as inspiration what the kbuild system in linux does.
> 
> Buglink: https://bugs.launchpad.net/qemu/+bug/1817345
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Antonio Ospite <antonio.ospite@collabora.com>
> ---
>  Makefile  | 4 ++++
>  configure | 5 +++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index e02b88bcb1..bed1323a45 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,5 +1,9 @@
>  # Makefile for QEMU.
>  
> +ifneq ($(words $(subst :, ,$(CURDIR))), 1)
> +  $(error main directory cannot contain spaces nor colons)
> +endif
> +
>  # Always point to the root of the build tree (needs GNU make).
>  BUILD_DIR=$(CURDIR)
>  
> diff --git a/configure b/configure
> index 9f12120ad9..2833d73ccc 100755
> --- a/configure
> +++ b/configure
> @@ -279,6 +279,11 @@ ld_has() {
>  # make source path absolute
>  source_path=$(cd "$(dirname -- "$0")"; pwd)
>  
> +if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
> +then
> +  error_exit "main directory cannot contain spaces nor colons"
> +fi
> +
>  # default parameters
>  cpu=""
>  iasl="iasl"
> 

Applied to my trivial-patches branch.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-26 15:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-26 14:47 [Qemu-devel] [PATCH v3 0/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 1/2] configure: set source_path only once and make its definition more robust Antonio Ospite
2019-06-26 15:56   ` Laurent Vivier
2019-05-26 14:47 ` [Qemu-devel] [PATCH v3 2/2] configure: disallow spaces and colons in source path and build path Antonio Ospite
2019-06-26 15:56   ` Laurent Vivier
2019-06-26 15:16 ` [Qemu-devel] [PATCH v3 0/2] " Antonio Ospite
2019-06-26 15:50   ` Laurent Vivier
2019-06-26 15:54     ` Antonio Ospite
2019-06-26 15:52   ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).