devtools: trap SIGINT is not recognizable to dash

Message ID 20180801052257.14869-1-gavin.hu@arm.com (mailing list archive)
State Accepted, archived
Headers
Series devtools: trap SIGINT is not recognizable to dash |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Gavin Hu Aug. 1, 2018, 5:22 a.m. UTC
  When running checkpatch.sh, it generates the following error
on some linux distributions(like Debian) with Dash as the
default shell interpreter.
trap: SIGINT: bad trap

The fix is to replace SIGINT with INT signal, it works for
both bash and dash.

Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
Cc: stable@dpdk.org

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@amr.com>
---
 devtools/checkpatches.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

John McNamara Aug. 1, 2018, 10:40 a.m. UTC | #1
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Gavin Hu
> Sent: Wednesday, August 1, 2018 6:23 AM
> To: dev@dpdk.org
> Cc: honnappa.nagarahalli@arm.com; gavin.hu@arm.com; stable@dpdk.org
> Subject: [dpdk-stable] [PATCH] devtools: trap SIGINT is not recognizable to
> dash
> 
> When running checkpatch.sh, it generates the following error on some linux
> distributions(like Debian) with Dash as the default shell interpreter.
> trap: SIGINT: bad trap
> 
> The fix is to replace SIGINT with INT signal, it works for both bash and
> dash.
> 
> Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@amr.com>

Acked-by: John McNamara <john.mcnamara@intel.com>
  
Varghese, Vipin Aug. 1, 2018, 1:09 p.m. UTC | #2
Checked with Ubuntu 16.04.4 LTS, it works.

Acked-by: Vipin Varghese <vipin.varghese@intel.com>

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org>
> Sent: Wednesday, August 1, 2018 4:10 PM
> To: Gavin Hu <gavin.hu@arm.com>; dev@dpdk.org
> Cc: honnappa.nagarahalli@arm.com; stable@dpdk.org
> Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] devtools: trap SIGINT is not
> recognizable to dash
> 
> 
> 
> > -----Original Message-----
> > From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Gavin Hu
> > Sent: Wednesday, August 1, 2018 6:23 AM
> > To: dev@dpdk.org
> > Cc: honnappa.nagarahalli@arm.com; gavin.hu@arm.com; stable@dpdk.org
> > Subject: [dpdk-stable] [PATCH] devtools: trap SIGINT is not
> > recognizable to dash
> >
> > When running checkpatch.sh, it generates the following error on some
> > linux distributions(like Debian) with Dash as the default shell interpreter.
> > trap: SIGINT: bad trap
> >
> > The fix is to replace SIGINT with INT signal, it works for both bash
> > and dash.
> >
> > Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@amr.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>
>
  
Thomas Monjalon Aug. 1, 2018, 2:37 p.m. UTC | #3
> > When running checkpatch.sh, it generates the following error on some linux
> > distributions(like Debian) with Dash as the default shell interpreter.
> > trap: SIGINT: bad trap
> > 
> > The fix is to replace SIGINT with INT signal, it works for both bash and
> > dash.
> > 
> > Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@amr.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>

Applied, thanks
  
Stephen Hemminger Aug. 3, 2018, 10:17 p.m. UTC | #4
On Wed,  1 Aug 2018 13:22:57 +0800
Gavin Hu <gavin.hu@arm.com> wrote:

> When running checkpatch.sh, it generates the following error
> on some linux distributions(like Debian) with Dash as the
> default shell interpreter.
> trap: SIGINT: bad trap
> 
> The fix is to replace SIGINT with INT signal, it works for
> both bash and dash.
> 
> Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@amr.com>
> ---
>  devtools/checkpatches.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index 2509269df..ba795ad1d 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -29,7 +29,7 @@ clean_tmp_files() {
>  	fi
>  }
>  
> -trap "clean_tmp_files" SIGINT
> +trap "clean_tmp_files" INT
>  
>  print_usage () {
>  	cat <<- END_OF_HELP

This patch alone is not sufficient to make checkpatch run successfully

./devtools/checkpatches.sh: 52: read: Illegal option -d

It looks like the -d flag to read is also a bash extension.

I recommend changing both checkpatches.sh and check-symbol-changes to have #!/bin/bash
  
Gavin Hu Aug. 4, 2018, 6:42 a.m. UTC | #5
Hi Stephen,

I am no sure only supporting bash is acceptable or not. Any impact to freebsd?

We should seek wider opinions about this.

I did not meet your problem, either bash or dash, what's your shell?

Best Regards,
Gavin

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Saturday, August 4, 2018 6:17 AM
> To: Gavin Hu <Gavin.Hu@arm.com>
> Cc: dev@dpdk.org; Honnappa Nagarahalli
> <Honnappa.Nagarahalli@arm.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] devtools: trap SIGINT is not recognizable to
> dash
>
> On Wed,  1 Aug 2018 13:22:57 +0800
> Gavin Hu <gavin.hu@arm.com> wrote:
>
> > When running checkpatch.sh, it generates the following error on some
> > linux distributions(like Debian) with Dash as the default shell
> > interpreter.
> > trap: SIGINT: bad trap
> >
> > The fix is to replace SIGINT with INT signal, it works for both bash
> > and dash.
> >
> > Fixes: 4bec48184e ("devtools: add checks for ABI symbol addition")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Gavin Hu <gavin.hu@arm.com>
> > Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@amr.com>
> > ---
> >  devtools/checkpatches.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index
> > 2509269df..ba795ad1d 100755
> > --- a/devtools/checkpatches.sh
> > +++ b/devtools/checkpatches.sh
> > @@ -29,7 +29,7 @@ clean_tmp_files() {
> >  fi
> >  }
> >
> > -trap "clean_tmp_files" SIGINT
> > +trap "clean_tmp_files" INT
> >
> >  print_usage () {
> >  cat <<- END_OF_HELP
>
> This patch alone is not sufficient to make checkpatch run successfully
>
> ./devtools/checkpatches.sh: 52: read: Illegal option -d
>
> It looks like the -d flag to read is also a bash extension.
>
> I recommend changing both checkpatches.sh and check-symbol-changes to
> have #!/bin/bash
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
  
Stephen Hemminger Aug. 6, 2018, 5:12 p.m. UTC | #6
On Sat, 4 Aug 2018 06:42:53 +0000
Gavin Hu <Gavin.Hu@arm.com> wrote:

> Hi Stephen,
> 
> I am no sure only supporting bash is acceptable or not. Any impact to freebsd?
> 
> We should seek wider opinions about this.
> 
> I did not meet your problem, either bash or dash, what's your shell?
> 
> Best Regards,
> Gavin

I am running Debian testing, still see complaints about -d

$ dpkg -S /bin/sh
diversion by dash from: /bin/sh
diversion by dash to: /bin/sh.distrib
dash: /bin/sh


Also, requiring bash is not that big an issue on FreeBSD. We already require gnu make
so requiring gnu shell is not something developers should really mind.
  

Patch

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 2509269df..ba795ad1d 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -29,7 +29,7 @@  clean_tmp_files() {
 	fi
 }
 
-trap "clean_tmp_files" SIGINT
+trap "clean_tmp_files" INT
 
 print_usage () {
 	cat <<- END_OF_HELP