[cs631apue] sish grades and end of semester

Jan Schaumann jschauma at stevens.edu
Tue Dec 21 21:22:50 EST 2021


Hello,

I've just sent out grades for your final assignment.
Most of you did well and were able to implement a
functional shell, and I hope that you all got a new
appreciation for all the work your normal shell does
for you, but at the same time removed some of the
magic and mystery from it.

After having graded all your submissions throughout
the semester, there are a few things that are worth
repeating, in the hope that constant repitition will
allow the lessons to sink in eventually, even if I
continue to sound like a broken record:

1) You need to check the return valu of any function
that may fail.  Even in this last assignment, many of
you still did not consistently do this (despite
claiming to do so in your checklist).

getenv(3), getpwuid(3), malloc(3), etc. are all
functions that may fail, return NULL, and cause your
program to segfault.

Please make it a habit to check _all_ function return
statuses!


2) You need to be very careful in how you manage
buffers and append data.  Many of you have started to
use e.g., strncat(3), but most of you use it in the
wrong way:

strcat(dest, src)

has the risk of overflowing 'dest' if 'src' is longer
than 'dest'.  But using

strncat(dest, src, strlen(src))

has the exact same problem!  You need to ensure that
the _destination_ can hold the string you're trying to
write.

Especially when performing multiple subsequent writes
do you need to ensure you account for however much
data you've already written!


3) Avoid code duplication and focus on readability and
clarity.  This is something that comes with time and
practice, but it's on you to develop good habits early
on.  Don't use an excuse like "but this is just a CS
assignment, this isn't the 'real world'".  There is no
real world.  What you do here and now is what you'll
do in whatever you perceive to be this so-called 'real
world'.

Habits are hard to break, but easy to develop, so
focus on developing good habits every step along the
way.


4) Finally, and perhaps most importantly: ask
questions!  If something isn't clear or obvious: ask!
If something doesn't make sense: ask!  If you think
there's something that you should know but don't fully
understand, don't be afraid to ask.  Chances are, at
least half of the rest of the class doesn't understand
it, either, and could benefit from an explanation.
And if they _do_ know the answer, then they can
explain it to you.

You can't learn if you don't seek clarifications or
answers to your questions.


Alright, I hope that you will take these last few
points as additional or repeated lessons from this
class, and that you deepened your understanding of the
Unix system as well as of programming in general.


This concludes our class this semester.  I will be
submitting letter grades based on all the numeric
scores you have to the registrar soon -- there
shouldn't be any surprises.

I hope you all stay alert and healthy throughout the
pandemic, keep in mind those around you who are most
at risk, and behave accordingly and responsibly.
Happy holidays to those of you who are celebrating,
and best of luck in your academic future.

-Jan


More information about the cs631apue mailing list