* [Qemu-devel] [PATCH] configure: remove bashism (since 2010)
@ 2015-12-10 0:53 marcandre.lureau
2015-12-10 0:57 ` Marc-André Lureau
2015-12-10 2:51 ` Eric Blake
0 siblings, 2 replies; 5+ messages in thread
From: marcandre.lureau @ 2015-12-10 0:53 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau
From: Marc-André Lureau <marcandre.lureau@redhat.com>
"type" is not POSIX shell, but a bashism. (found thanks to shellcheck)
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index ba57b3f..90eff82 100755
--- a/configure
+++ b/configure
@@ -158,7 +158,7 @@ symlink() {
# check whether a command is available to this shell (may be either an
# executable or a builtin)
has() {
- type "$1" >/dev/null 2>&1
+ which "$1" >/dev/null 2>&1
}
# search for an executable in PATH
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: remove bashism (since 2010)
2015-12-10 0:53 [Qemu-devel] [PATCH] configure: remove bashism (since 2010) marcandre.lureau
@ 2015-12-10 0:57 ` Marc-André Lureau
2015-12-10 2:52 ` Eric Blake
2015-12-10 2:51 ` Eric Blake
1 sibling, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2015-12-10 0:57 UTC (permalink / raw)
To: QEMU
Hi
On Thu, Dec 10, 2015 at 1:53 AM, <marcandre.lureau@redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> "type" is not POSIX shell, but a bashism. (found thanks to shellcheck)
>
A subsidiary question is whether qemu really care about using POSIX
shell, or we can just depend on bashism. That would help with
simplifying some Makefile lines too.
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> configure | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index ba57b3f..90eff82 100755
> --- a/configure
> +++ b/configure
> @@ -158,7 +158,7 @@ symlink() {
> # check whether a command is available to this shell (may be either an
> # executable or a builtin)
> has() {
> - type "$1" >/dev/null 2>&1
> + which "$1" >/dev/null 2>&1
> }
>
> # search for an executable in PATH
> --
> 2.5.0
>
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: remove bashism (since 2010)
2015-12-10 0:53 [Qemu-devel] [PATCH] configure: remove bashism (since 2010) marcandre.lureau
2015-12-10 0:57 ` Marc-André Lureau
@ 2015-12-10 2:51 ` Eric Blake
2015-12-10 9:46 ` Marc-André Lureau
1 sibling, 1 reply; 5+ messages in thread
From: Eric Blake @ 2015-12-10 2:51 UTC (permalink / raw)
To: marcandre.lureau, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 996 bytes --]
On 12/09/2015 05:53 PM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> "type" is not POSIX shell, but a bashism. (found thanks to shellcheck)
NACK. 'type' is POSIX, and shellcheck is buggy.
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> configure | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index ba57b3f..90eff82 100755
> --- a/configure
> +++ b/configure
> @@ -158,7 +158,7 @@ symlink() {
> # check whether a command is available to this shell (may be either an
> # executable or a builtin)
> has() {
> - type "$1" >/dev/null 2>&1
> + which "$1" >/dev/null 2>&1
Conversely, 'which' is _not_ POSIX, and therefore less portable than 'type'.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: remove bashism (since 2010)
2015-12-10 0:57 ` Marc-André Lureau
@ 2015-12-10 2:52 ` Eric Blake
0 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2015-12-10 2:52 UTC (permalink / raw)
To: Marc-André Lureau, QEMU
[-- Attachment #1: Type: text/plain, Size: 839 bytes --]
On 12/09/2015 05:57 PM, Marc-André Lureau wrote:
> Hi
>
> On Thu, Dec 10, 2015 at 1:53 AM, <marcandre.lureau@redhat.com> wrote:
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> "type" is not POSIX shell, but a bashism. (found thanks to shellcheck)
>>
>
> A subsidiary question is whether qemu really care about using POSIX
> shell, or we can just depend on bashism. That would help with
> simplifying some Makefile lines too.
Debian uses dash, not bash, as /bin/sh. As both 'configure' and
'Makefile' depend on '/bin/sh', then yes, we care about POSIX compliance.
Only in scripts that explicitly require /bin/bash, such as much of the
scripts under tests/, can we get away with bashisms.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: remove bashism (since 2010)
2015-12-10 2:51 ` Eric Blake
@ 2015-12-10 9:46 ` Marc-André Lureau
0 siblings, 0 replies; 5+ messages in thread
From: Marc-André Lureau @ 2015-12-10 9:46 UTC (permalink / raw)
To: Eric Blake; +Cc: QEMU
Hi
On Thu, Dec 10, 2015 at 3:51 AM, Eric Blake <eblake@redhat.com> wrote:
> On 12/09/2015 05:53 PM, marcandre.lureau@redhat.com wrote:
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> "type" is not POSIX shell, but a bashism. (found thanks to shellcheck)
>
> NACK. 'type' is POSIX, and shellcheck is buggy.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/type.html
So is checkbashisms then. I am just spreading that wrong idea then :)
>
>>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>> configure | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index ba57b3f..90eff82 100755
>> --- a/configure
>> +++ b/configure
>> @@ -158,7 +158,7 @@ symlink() {
>> # check whether a command is available to this shell (may be either an
>> # executable or a builtin)
>> has() {
>> - type "$1" >/dev/null 2>&1
>> + which "$1" >/dev/null 2>&1
>
> Conversely, 'which' is _not_ POSIX, and therefore less portable than 'type'.
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-10 9:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10 0:53 [Qemu-devel] [PATCH] configure: remove bashism (since 2010) marcandre.lureau
2015-12-10 0:57 ` Marc-André Lureau
2015-12-10 2:52 ` Eric Blake
2015-12-10 2:51 ` Eric Blake
2015-12-10 9:46 ` Marc-André Lureau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.