The shell returns a wrong error code when it should return an error (on a bad file descriptor).
In this task, you will go through the whole work of fixing a bug: You have to analyze the situation, find the source of that bug in the code, and finally fix it.
In this task, you will also learn much about how a shell internally works. This will help you definetely if you want to do shell programming some day, or just want to dig more into the internals of file descriptors.
As soon as my other task gets reviewed, I'm going to claim this one.
I would like to work on this task.
This task has been assigned to Puck Meerburg. You have 240 hours to complete this task, good luck!
I've got some problems compiling the /bin/sh sources. I got them, but got gcc: printf.o: No such file or directory when compiling. Do you know what the problem is?
What exactly are you doing to build it? If sh depends on other files, you have to build these first. I think building a whole release would solve the issue. Maybe you need less, but this would be the safe way.
Anyway, you can come to #netbsd-code on freenode to ask us questions. This is more direct than Google Melange (but be careful - at some times there won't be anybody awake on this channel).
I fixed it by cvsing some other dependencies, but now *.netbsd.org is offline :(
Yep, there was a downtime yesterday. Anyway, things should be up and running now. You can always use one of the anoncvs servers, but probably didn't see them.
I have some problems, mostly because the problem seems to ly in _exit, not sh:
- When being debugged, even without breakpoints, it just works.
- The same binary not being debugged returns 0.
I can't seem to find the logic in this, even turning on DEBUG=2 makes it work...
The work on this task is ready to be reviewed.
To make it work:
cvs checkout, then patch error.c with the included .diff!
I just checked the patch, and it works, though I don't know what exactly you did. Apparently, you set the return code when an exception occurs, but I didn't dig deep enough into the code to evaluate how this affects other code.
Could you please elaborate what did not work and what you did now (also to have a commit message)? Anyway, the task is done, so I will mark it as closed now.
Congratulations, this task has been completed successfully.
I wrote this:
In eval.c, line 870 another handler is set for handling exceptions for when a command is running. When an error (EXERROR) occurs, this line will exit with value `exerrno`. This value, however, wasn't set when `exraise`ing (error.c) the exception. Therefore, all exceptions that happened while running a command would return 0.
This is fixed by adding `exerrno = e` to `exraise`, making generic errors exit with `1`.
Ok, thank you, that is sufficient! Good luck with the next task (which is already assigned)!