[1/4] qemu-iotests: remove bash shebang from library files
diff mbox series

Message ID 20190927141728.7137-2-crosa@redhat.com
State New
Headers show
Series
  • iotests: trivial cleanups
Related show

Commit Message

Cleber Rosa Sept. 27, 2019, 2:17 p.m. UTC
Due to not being able to find a reason to have shebangs on files that
are not executable.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/qemu-iotests/common.config  | 2 --
 tests/qemu-iotests/common.filter  | 2 --
 tests/qemu-iotests/common.nbd     | 1 -
 tests/qemu-iotests/common.pattern | 2 --
 tests/qemu-iotests/common.qemu    | 2 --
 tests/qemu-iotests/common.rc      | 2 --
 tests/qemu-iotests/common.tls     | 2 --
 7 files changed, 13 deletions(-)

Comments

Eric Blake Sept. 27, 2019, 4:37 p.m. UTC | #1
On 9/27/19 9:17 AM, Cleber Rosa wrote:
> Due to not being able to find a reason to have shebangs on files that
> are not executable.
> 
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>   tests/qemu-iotests/common.config  | 2 --
>   tests/qemu-iotests/common.filter  | 2 --
>   tests/qemu-iotests/common.nbd     | 1 -
>   tests/qemu-iotests/common.pattern | 2 --
>   tests/qemu-iotests/common.qemu    | 2 --
>   tests/qemu-iotests/common.rc      | 2 --
>   tests/qemu-iotests/common.tls     | 2 --
>   7 files changed, 13 deletions(-)
> 

Loss of the shebang changes the mode in which emacs opens the files 
(from Shell-script[bash] to Conf[space] in my case).  I agree that a #! 
comment is not appropriate for a file that is not executable as a 
standalone file, but it becomes harder to edit the file correctly unless 
we replace it with some other way of letting editors realize that the 
contents of each file is still meant to be consumed by bash.

Something like this would work:

# hey emacs, this file will be sourced by bash: -*- sh -*-
Cleber Rosa Oct. 9, 2019, 4:26 p.m. UTC | #2
On Fri, Sep 27, 2019 at 11:37:52AM -0500, Eric Blake wrote:
> On 9/27/19 9:17 AM, Cleber Rosa wrote:
> > Due to not being able to find a reason to have shebangs on files that
> > are not executable.
> > 
> > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > ---
> >   tests/qemu-iotests/common.config  | 2 --
> >   tests/qemu-iotests/common.filter  | 2 --
> >   tests/qemu-iotests/common.nbd     | 1 -
> >   tests/qemu-iotests/common.pattern | 2 --
> >   tests/qemu-iotests/common.qemu    | 2 --
> >   tests/qemu-iotests/common.rc      | 2 --
> >   tests/qemu-iotests/common.tls     | 2 --
> >   7 files changed, 13 deletions(-)
> > 
> 
> Loss of the shebang changes the mode in which emacs opens the files (from
> Shell-script[bash] to Conf[space] in my case).  I agree that a #! comment is
> not appropriate for a file that is not executable as a standalone file, but
> it becomes harder to edit the file correctly unless we replace it with some
> other way of letting editors realize that the contents of each file is still
> meant to be consumed by bash.
> 
> Something like this would work:
> 
> # hey emacs, this file will be sourced by bash: -*- sh -*-
>

Yes, good point.  Will send that on a v2.

- Cleber.

> -- 
> Eric Blake, Principal Software Engineer
> Red Hat, Inc.           +1-919-301-3226
> Virtualization:  qemu.org | libvirt.org
Cleber Rosa Oct. 9, 2019, 6:38 p.m. UTC | #3
On Wed, Oct 09, 2019 at 12:26:27PM -0400, Cleber Rosa wrote:
> On Fri, Sep 27, 2019 at 11:37:52AM -0500, Eric Blake wrote:
> > On 9/27/19 9:17 AM, Cleber Rosa wrote:
> > > Due to not being able to find a reason to have shebangs on files that
> > > are not executable.
> > > 
> > > Signed-off-by: Cleber Rosa <crosa@redhat.com>
> > > ---
> > >   tests/qemu-iotests/common.config  | 2 --
> > >   tests/qemu-iotests/common.filter  | 2 --
> > >   tests/qemu-iotests/common.nbd     | 1 -
> > >   tests/qemu-iotests/common.pattern | 2 --
> > >   tests/qemu-iotests/common.qemu    | 2 --
> > >   tests/qemu-iotests/common.rc      | 2 --
> > >   tests/qemu-iotests/common.tls     | 2 --
> > >   7 files changed, 13 deletions(-)
> > > 
> > 
> > Loss of the shebang changes the mode in which emacs opens the files (from
> > Shell-script[bash] to Conf[space] in my case).  I agree that a #! comment is
> > not appropriate for a file that is not executable as a standalone file, but
> > it becomes harder to edit the file correctly unless we replace it with some
> > other way of letting editors realize that the contents of each file is still
> > meant to be consumed by bash.
> > 
> > Something like this would work:
> > 
> > # hey emacs, this file will be sourced by bash: -*- sh -*-
> >
> 
> Yes, good point.  Will send that on a v2.
>

BTW, in addition to that, we may add to .editorconfig something like:

[tests/qemu-iotests/common.*]
indent_style = space
indent_size = 4
file_type_emacs = sh

Although I was expecting editorconfig to provide a mode hint for other
editors, which doesn't seem to be the case.

Cheers,
- Cleber.

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

Patch
diff mbox series

diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 9bd1a5a6fc..6956d38d4c 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -1,5 +1,3 @@ 
-#!/usr/bin/env bash
-#
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 445a1c23e0..043c62c10c 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -1,5 +1,3 @@ 
-#!/usr/bin/env bash
-#
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
 #
diff --git a/tests/qemu-iotests/common.nbd b/tests/qemu-iotests/common.nbd
index 24b01b60aa..5a9991b7ef 100644
--- a/tests/qemu-iotests/common.nbd
+++ b/tests/qemu-iotests/common.nbd
@@ -1,4 +1,3 @@ 
-#!/usr/bin/env bash
 # -*- shell-script-mode -*-
 #
 # Helpers for NBD server related config
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index 4f5e5bcea0..e8d97dd2bb 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -1,5 +1,3 @@ 
-#!/usr/bin/env bash
-#
 # Copyright (C) 2009 Red Hat, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 8d2021a7eb..5bdfde890d 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -1,5 +1,3 @@ 
-#!/usr/bin/env bash
-#
 # This allows for launching of multiple QEMU instances, with independent
 # communication possible to each instance.
 #
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index e45cdfa66b..19bddacf11 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -1,5 +1,3 @@ 
-#!/usr/bin/env bash
-#
 # Copyright (C) 2009 Red Hat, Inc.
 # Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
index 54c331d7a5..61f8ef6037 100644
--- a/tests/qemu-iotests/common.tls
+++ b/tests/qemu-iotests/common.tls
@@ -1,5 +1,3 @@ 
-#!/usr/bin/env bash
-#
 # Helpers for TLS related config
 #
 # Copyright (C) 2018 Red Hat, Inc.