Re: [Cocci] [RFC PATCH] scripts: coccicheck: Improve error feedback when coccicheck fails

2020-09-14 Thread Julia Lawall


On Mon, 14 Sep 2020, Markus Elfring wrote:

>  How do you think about to use the following check variant?
> 
>  +if [ "${DEBUG_FILE}" != '/dev/null' -a "${DEBUG_FILE}" != '' ]; 
>  then
> …
> > I have no idea.  Why can't they be nclosed by double quotes as well?
>
> Both script variants can work.
> Such coding style variations can trigger different run time characteristics
> (besides expressing specific intentions), can't they?

Again, I have no idea.  But the runtime cost of these tests must be
microscopic as compared to the overall cost of make coccicheck.

julia___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [RFC PATCH] scripts: coccicheck: Improve error feedback when coccicheck fails

2020-09-14 Thread Julia Lawall



On Mon, 14 Sep 2020, Markus Elfring wrote:

> >> How do you think about to use the following check variant?
> >>
> >> +  if [ "${DEBUG_FILE}" != '/dev/null' -a "${DEBUG_FILE}" != '' ]; then
> >
> > What difference does it make?
>
> I propose two implementation details for further development considerations.
>
> 1. Do you care if any variable names should be enclosed by curly brackets
>in such script code?
>
> 2. A changeable value should be compared to two string literals here.
>Varying contents should be enclosed by double quotes.
>Constant values can be enclosed by single quotes, can't they?

I have no idea.  Why can't they be nclosed by double quotes as well?

julia
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [RFC PATCH] scripts: coccicheck: Improve error feedback when coccicheck fails

2020-09-14 Thread Julia Lawall


On Mon, 14 Sep 2020, Markus Elfring wrote:

> …
> > +++ b/scripts/coccicheck
> > @@ -126,8 +126,14 @@ run_cmd_parmap() {
> > if [ $VERBOSE -ne 0 ] ; then
> > echo "Running ($NPROC in parallel): $@"
> > fi
> > -   echo $@ >>$DEBUG_FILE
> > -   $@ 2>>$DEBUG_FILE
> > +   if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
> …
>
> How do you think about to use the following check variant?
>
> + if [ "${DEBUG_FILE}" != '/dev/null' -a "${DEBUG_FILE}" != '' ]; then

What difference does it make?

julia___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [RFC PATCH] scripts: coccicheck: Improve error feedback when coccicheck fails

2020-09-14 Thread Markus Elfring
…
> +++ b/scripts/coccicheck
> @@ -126,8 +126,14 @@ run_cmd_parmap() {
>   if [ $VERBOSE -ne 0 ] ; then
>   echo "Running ($NPROC in parallel): $@"
>   fi
> - echo $@ >>$DEBUG_FILE
> - $@ 2>>$DEBUG_FILE
> + if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
…

How do you think about to use the following check variant?

+   if [ "${DEBUG_FILE}" != '/dev/null' -a "${DEBUG_FILE}" != '' ]; then


Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [RFC PATCH] scripts: coccicheck: Improve error feedback when coccicheck fails

2020-09-13 Thread Julia Lawall



On Sun, 13 Sep 2020, Sumera Priyadarsini wrote:

> Currently, coccicheck fails with only the message "coccicheck failed"
> and the error code for the failure. To obtain the error logs,
> one needs to specify a debug file using the DEBUG_FILE option.
>
> Modify coccicheck to display error logs when it crashes unless
> DEBUG_FILE is set, in which case, the error logs are stored in
> the specified debug file.

Applied, thanks.

julia

>
> Signed-off-by: Sumera Priyadarsini 
> ---
>  scripts/coccicheck | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index e04d328210ac..dbeafa21f359 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -126,8 +126,14 @@ run_cmd_parmap() {
>   if [ $VERBOSE -ne 0 ] ; then
>   echo "Running ($NPROC in parallel): $@"
>   fi
> - echo $@ >>$DEBUG_FILE
> - $@ 2>>$DEBUG_FILE
> + if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
> +echo $@>>$DEBUG_FILE
> +$@ 2>>$DEBUG_FILE
> +else
> +echo $@
> +$@ 2>&1
> + fi
> +
>   err=$?
>   if [[ $err -ne 0 ]]; then
>   echo "coccicheck failed"
> --
> 2.25.1
>
> ___
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [RFC PATCH] scripts: coccicheck: Improve error feedback when coccicheck fails

2020-09-13 Thread Sumera Priyadarsini
Currently, coccicheck fails with only the message "coccicheck failed"
and the error code for the failure. To obtain the error logs,
one needs to specify a debug file using the DEBUG_FILE option.

Modify coccicheck to display error logs when it crashes unless
DEBUG_FILE is set, in which case, the error logs are stored in
the specified debug file.

Signed-off-by: Sumera Priyadarsini 
---
 scripts/coccicheck | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index e04d328210ac..dbeafa21f359 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -126,8 +126,14 @@ run_cmd_parmap() {
if [ $VERBOSE -ne 0 ] ; then
echo "Running ($NPROC in parallel): $@"
fi
-   echo $@ >>$DEBUG_FILE
-   $@ 2>>$DEBUG_FILE
+   if [ "$DEBUG_FILE" != "/dev/null" -a "$DEBUG_FILE" != "" ]; then
+echo $@>>$DEBUG_FILE
+$@ 2>>$DEBUG_FILE
+else
+echo $@
+$@ 2>&1
+   fi
+
err=$?
if [[ $err -ne 0 ]]; then
echo "coccicheck failed"
-- 
2.25.1

___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci