diff mbox series

[Makefile] Exit if provided an incorrect argument

Message ID VI1PR0801MB20145F5DF9B9E836FB02F5BCE0A10@VI1PR0801MB2014.eurprd08.prod.outlook.com
State New
Headers show
Series [Makefile] Exit if provided an incorrect argument | expand

Commit Message

Matthew Malcomson Dec. 14, 2018, 2:26 p.m. UTC
At the moment the ./testrun.sh file generated for testing a new glibc
doesn't handle incorrect arguments well.
It prints the usage of the script in an infinite loop.

This patch stops the infinite loop by exiting the program.

Tested by manually running the script after building.
I don't have commit rights, so if OK could someone commit this for me.
OK for master?

ChangeLog:

2018-11-29  Matthew Malcomson  <matthew.malcomson@arm.com>

	* Makefile (testrun.sh): Exit if provided incorrect arg.
diff --git a/Makefile b/Makefile
index b4703e48fec93075cd5e3ddd83469705d2fee8f8..1e1866be3da1ba4520911eb27016544de419161b 100644
--- a/Makefile
+++ b/Makefile
@@ -148,6 +148,7 @@ while test $$# -gt 0 ; do
       ;;
     --*)
       usage
+      exit 1
       ;;
     *)
       break

Comments

Matthew Malcomson Jan. 15, 2019, 10 a.m. UTC | #1
ping


On 14/12/18 14:26, Matthew Malcomson wrote:
> At the moment the ./testrun.sh file generated for testing a new glibc
> doesn't handle incorrect arguments well.
> It prints the usage of the script in an infinite loop.
>
> This patch stops the infinite loop by exiting the program.
>
> Tested by manually running the script after building.
> I don't have commit rights, so if OK could someone commit this for me.
> OK for master?
>
> ChangeLog:
>
> 2018-11-29  Matthew Malcomson  <matthew.malcomson@arm.com>
>
> 	* Makefile (testrun.sh): Exit if provided incorrect arg.
>
>
> diff --git a/Makefile b/Makefile
> index b4703e48fec93075cd5e3ddd83469705d2fee8f8..1e1866be3da1ba4520911eb27016544de419161b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -148,6 +148,7 @@ while test $$# -gt 0 ; do
>         ;;
>       --*)
>         usage
> +      exit 1
>         ;;
>       *)
>         break
>
Florian Weimer Jan. 15, 2019, 10:03 a.m. UTC | #2
* Matthew Malcomson:

> --- a/Makefile
> +++ b/Makefile
> @@ -148,6 +148,7 @@ while test $$# -gt 0 ; do
>        ;;
>      --*)
>        usage
> +      exit 1
>        ;;
>      *)
>        break

I think you should add the exit to the usage function.

Thanks,
Florian
Matthew Malcomson Jan. 15, 2019, 10:33 a.m. UTC | #3
On 15/01/19 10:03, Florian Weimer wrote:
> * Matthew Malcomson:
>
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -148,6 +148,7 @@ while test $$# -gt 0 ; do
>>         ;;
>>       --*)
>>         usage
>> +      exit 1
>>         ;;
>>       *)
>>         break
> I think you should add the exit to the usage function.
>
> Thanks,
> Florian

Makes sense -- thanks!
Fixed patch attached.

ChangeLog:

2019-01-15  Matthew Malcomson  <matthew.malcomson@arm.com>

	* Makefile (testrun.sh): Exit if provided incorrect arg.


--- Patch Inlined for ease of reply ----

diff --git a/Makefile b/Makefile
index b4703e4..9d76d86 100644
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,7 @@ GCONV_PATH="$${builddir}/iconvdata"
  usage () {
    echo "usage: $$0 [--tool=strace] PROGRAM [ARGUMENTS...]" 2>&1
    echo "       $$0 --tool=valgrind PROGRAM [ARGUMENTS...]" 2>&1
+  exit 1
  }

  toolname=default
diff --git a/Makefile b/Makefile
index b4703e4..9d76d86 100644
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,7 @@ GCONV_PATH="$${builddir}/iconvdata"
 usage () {
   echo "usage: $$0 [--tool=strace] PROGRAM [ARGUMENTS...]" 2>&1
   echo "       $$0 --tool=valgrind PROGRAM [ARGUMENTS...]" 2>&1
+  exit 1
 }
 
 toolname=default
Florian Weimer Feb. 4, 2019, 12:09 p.m. UTC | #4
* Matthew Malcomson:

> On 15/01/19 10:03, Florian Weimer wrote:
>> * Matthew Malcomson:
>>
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -148,6 +148,7 @@ while test $$# -gt 0 ; do
>>>         ;;
>>>       --*)
>>>         usage
>>> +      exit 1
>>>         ;;
>>>       *)
>>>         break
>> I think you should add the exit to the usage function.
>>
>> Thanks,
>> Florian
>
> Makes sense -- thanks!
> Fixed patch attached.

Thanks, pushed.

Florian
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index b4703e48fec93075cd5e3ddd83469705d2fee8f8..1e1866be3da1ba4520911eb27016544de419161b 100644
--- a/Makefile
+++ b/Makefile
@@ -148,6 +148,7 @@  while test $$# -gt 0 ; do
       ;;
     --*)
       usage
+      exit 1
       ;;
     *)
       break