[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] shell script error management in ash (set of 6 patches)
From:       "Roberto A. Foglietta" <roberto.foglietta () gmail ! com>
Date:       2021-08-22 17:35:04
Message-ID: CAJGKYO50TzvUe9++=n5OaMrOx7Wq-=EbRUvTZ55aBL_4pN6++A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Il giorno dom 22 ago 2021 alle ore 16:33 Roberto A. Foglietta <
roberto.foglietta@gmail.com> ha scritto:

> Il giorno dom 22 ago 2021 alle ore 15:53 Roberto A. Foglietta <
> roberto.foglietta@gmail.com> ha scritto:
>
>> Hi Harald and Denys,
>>
>>  - it add a printf to highlight a possible memory leak in a not-exit
>> condition (**)
>>
>
>  The patch without printf can be found here:
>
>  https://github.com/robang74/tinycore-editor/tree/main/busybox/patches
>
>
I took a code revision and I found some minor issues that I am addressing
with this patch.
I have also updated the test suite for more comprehensive tests and removed
1 redundancy.

Cheers,
-- 
Roberto A. Foglietta
+39.349.33.30.697

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr">Il giorno dom 22 ago 2021 alle ore 16:33 Roberto A. \
Foglietta &lt;<a href="mailto:roberto.foglietta@gmail.com">roberto.foglietta@gmail.com</a>&gt; \
ha scritto:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Il giorno dom 22 ago \
2021 alle ore 15:53 Roberto A. Foglietta &lt;<a \
href="mailto:roberto.foglietta@gmail.com" \
target="_blank">roberto.foglietta@gmail.com</a>&gt; ha scritto:<br></div><div \
class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi \
Harald and Denys,</div><div><br></div><div>  - it add a printf to highlight a \
possible memory leak in a not-exit condition (**)</div></div> \
</blockquote></div><div><br></div>  The patch without printf can be found here:<br \
clear="all"><div><br></div><div>  <a \
href="https://github.com/robang74/tinycore-editor/tree/main/busybox/patches" \
target="_blank">https://github.com/robang74/tinycore-editor/tree/main/busybox/patches</a><br></div><div><br></div></div></blockquote><div><br></div><div>I \
took a code revision and I found some minor issues that I am addressing with this \
patch.  </div></div>I have also updated the test suite for more comprehensive tests \
and removed 1 redundancy.<br clear="all"><div><br></div><div>Cheers,</div>-- <br><div \
dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Roberto A. \
Foglietta</div><div>+39.349.33.30.697</div></div></div></div></div></div>


["busybox-1.33.1-errflag+exitshell-instead-of-raise_exception.patch" (application/octet-stream)]

--- src.0/shell/ash.c	2021-08-22 18:31:09.763207836 +0200
+++ src/shell/ash.c	2021-08-22 19:22:47.479281989 +0200
@@ -9163,6 +9163,8 @@ static int evalcommand(union node *, int
 static int evalbltin(const struct builtincmd *, int, char **, int);
 static void prehash(union node *);
 
+#define errflag (trap[NSIG] && (Eflag || (!Eflag && !funcline)))
+
 /*
  * Evaluate a parse tree.  The value is left in the global variable
  * exitstatus.
@@ -9209,7 +9211,7 @@ evaltree(union node *n, int flags)
 	case NCMD:
 		evalfn = evalcommand;
  checkexit:
-		if ((eflag || trap[NSIG]) && !(flags & EV_TESTED))
+		if ((errflag) && !(flags & EV_TESTED))
 			checkexit = ~0;
 		goto calleval;
 	case NFOR:
@@ -9284,7 +9286,7 @@ evaltree(union node *n, int flags)
 	dotrap();
 
 	if (checkexit & status) {
-		if(trap[NSIG] && (Eflag || (!Eflag && !funcline))) {
+		if(errflag) {
 				static bool recursive = 0;
 				if(!recursive) {
 					int savelineno = lineno;
@@ -9296,15 +9298,13 @@ evaltree(union node *n, int flags)
 					doingtrap = 0;
 					lineno = savelineno;
 					exitstatus = savestatus;
-					if(eflag)
-						exitshell();
 			}
 		}
 		if(eflag)
-			raise_exception(EXEND);
+			exitshell();
 	}
 	if (flags & EV_EXIT)
-		raise_exception(EXEND);
+			exitshell();
 
 	popstackmark(&smark);
 	TRACE(("leaving evaltree (no interrupts)\n"));

["testsuite.tgz" (application/x-compressed)]

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic