diff mbox

[8/9] xfs: checkbashisms in all script files

Message ID 152518921090.23023.14958881774088486712.stgit@magnolia (mailing list archive)
State Superseded
Headers show

Commit Message

Darrick J. Wong May 1, 2018, 3:40 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Find all the /bin/sh scripts in xfsprogs and check for bashisms.

Cc: sandeen@sandeen.net
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/711.out |    1 +
 tests/xfs/group   |    1 +
 3 files changed, 53 insertions(+)
 create mode 100755 tests/xfs/711
 create mode 100644 tests/xfs/711.out



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Eryu Guan May 2, 2018, 8:55 a.m. UTC | #1
On Tue, May 01, 2018 at 08:40:10AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Find all the /bin/sh scripts in xfsprogs and check for bashisms.
> 
> Cc: sandeen@sandeen.net
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Looks fine to me, but I'd like a review from Eric too, as it's a
"maintainer script" :)

> ---
>  tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/711.out |    1 +
>  tests/xfs/group   |    1 +
>  3 files changed, 53 insertions(+)
>  create mode 100755 tests/xfs/711
>  create mode 100644 tests/xfs/711.out
> 
> 
> diff --git a/tests/xfs/711 b/tests/xfs/711
> new file mode 100755
> index 00000000..d3dc3cd4
> --- /dev/null
> +++ b/tests/xfs/711
> @@ -0,0 +1,51 @@
> +#! /bin/bash
> +# FS QA Test No. 711
> +#
> +# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2018 Oracle, Inc.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
> +
> +# get standard environment
> +. ./common/rc
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
> +_require_command "$CHECKBASHISMS_PROG" checkbashisms
> +
> +test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
> +
> +rm -f $seqres.full
> +
> +find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do

Do we care about spaces between "#!" and "/bin/sh"? i.e. "#! /bin/sh",
sometimes there can be space(s).

Thanks,
Eryu

> +	$CHECKBASHISMS_PROG $f
> +done
> +
> +status=0
> diff --git a/tests/xfs/711.out b/tests/xfs/711.out
> new file mode 100644
> index 00000000..52ff4745
> --- /dev/null
> +++ b/tests/xfs/711.out
> @@ -0,0 +1 @@
> +QA output created by 711
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 39e259e8..b7da3fba 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -443,3 +443,4 @@
>  443 auto quick ioctl fsr
>  444 auto quick
>  445 auto quick filestreams
> +711 auto quick
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Tulak May 2, 2018, 9:13 a.m. UTC | #2
On Wed, May 2, 2018 at 10:55 AM, Eryu Guan <guaneryu@gmail.com> wrote:
> On Tue, May 01, 2018 at 08:40:10AM -0700, Darrick J. Wong wrote:
>> From: Darrick J. Wong <darrick.wong@oracle.com>
>>
>> Find all the /bin/sh scripts in xfsprogs and check for bashisms.
>>
>> Cc: sandeen@sandeen.net
>> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
>
> Looks fine to me, but I'd like a review from Eric too, as it's a
> "maintainer script" :)
>

A good idea, looks generally ok to me (and now we really wait for Eric).

[snip]
>> +
>> +find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do
>
> Do we care about spaces between "#!" and "/bin/sh"? i.e. "#! /bin/sh",
> sometimes there can be space(s).
>

As far as I know, spaces are completely OK and allowed and accepted
everywhere, so I would add them here too.

Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Darrick J. Wong May 2, 2018, 2:59 p.m. UTC | #3
On Wed, May 02, 2018 at 04:55:03PM +0800, Eryu Guan wrote:
> On Tue, May 01, 2018 at 08:40:10AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Find all the /bin/sh scripts in xfsprogs and check for bashisms.
> > 
> > Cc: sandeen@sandeen.net
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Looks fine to me, but I'd like a review from Eric too, as it's a
> "maintainer script" :)
> 
> > ---
> >  tests/xfs/711     |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/xfs/711.out |    1 +
> >  tests/xfs/group   |    1 +
> >  3 files changed, 53 insertions(+)
> >  create mode 100755 tests/xfs/711
> >  create mode 100644 tests/xfs/711.out
> > 
> > 
> > diff --git a/tests/xfs/711 b/tests/xfs/711
> > new file mode 100755
> > index 00000000..d3dc3cd4
> > --- /dev/null
> > +++ b/tests/xfs/711
> > @@ -0,0 +1,51 @@
> > +#! /bin/bash
> > +# FS QA Test No. 711
> > +#
> > +# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
> > +#
> > +#-----------------------------------------------------------------------
> > +# Copyright (c) 2018 Oracle, Inc.
> > +#
> > +# This program is free software; you can redistribute it and/or
> > +# modify it under the terms of the GNU General Public License as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it would be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program; if not, write the Free Software Foundation,
> > +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> > +#
> > +#-----------------------------------------------------------------------
> > +#
> > +
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1	# failure is the default!
> > +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
> > +
> > +# get standard environment
> > +. ./common/rc
> > +
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_supported_os Linux
> > +export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
> > +_require_command "$CHECKBASHISMS_PROG" checkbashisms
> > +
> > +test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
> > +
> > +rm -f $seqres.full
> > +
> > +find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do
> 
> Do we care about spaces between "#!" and "/bin/sh"? i.e. "#! /bin/sh",
> sometimes there can be space(s).

Yes, I suppose we do care and should look for '^#!.*/bin/bash'.  I'll
also fix it to look only for files since that's all we care about.

--D

> Thanks,
> Eryu
> 
> > +	$CHECKBASHISMS_PROG $f
> > +done
> > +
> > +status=0
> > diff --git a/tests/xfs/711.out b/tests/xfs/711.out
> > new file mode 100644
> > index 00000000..52ff4745
> > --- /dev/null
> > +++ b/tests/xfs/711.out
> > @@ -0,0 +1 @@
> > +QA output created by 711
> > diff --git a/tests/xfs/group b/tests/xfs/group
> > index 39e259e8..b7da3fba 100644
> > --- a/tests/xfs/group
> > +++ b/tests/xfs/group
> > @@ -443,3 +443,4 @@
> >  443 auto quick ioctl fsr
> >  444 auto quick
> >  445 auto quick filestreams
> > +711 auto quick
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/xfs/711 b/tests/xfs/711
new file mode 100755
index 00000000..d3dc3cd4
--- /dev/null
+++ b/tests/xfs/711
@@ -0,0 +1,51 @@ 
+#! /bin/bash
+# FS QA Test No. 711
+#
+# checkbashisms on all /bin/sh scripts.  This is a maintainer script.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
+
+# get standard environment
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+export CHECKBASHISMS_PROG="`set_prog_path checkbashisms`"
+_require_command "$CHECKBASHISMS_PROG" checkbashisms
+
+test -z "$WORKAREA" && _notrun "Can't find xfsprogs source"
+
+rm -f $seqres.full
+
+find $WORKAREA -name 'xfs*.sh' -print0 | xargs -0 grep '^#!/bin/sh' | sed -e 's/:.*$//g' | while read f; do
+	$CHECKBASHISMS_PROG $f
+done
+
+status=0
diff --git a/tests/xfs/711.out b/tests/xfs/711.out
new file mode 100644
index 00000000..52ff4745
--- /dev/null
+++ b/tests/xfs/711.out
@@ -0,0 +1 @@ 
+QA output created by 711
diff --git a/tests/xfs/group b/tests/xfs/group
index 39e259e8..b7da3fba 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -443,3 +443,4 @@ 
 443 auto quick ioctl fsr
 444 auto quick
 445 auto quick filestreams
+711 auto quick