Friday, February 10, 2012

2/10/2012 (TOS Chapter 7)

This chapter covers patches, and how to create and submit them.  We were asked to do exercises 7.2.2, 7.8, and 7.9.


To do exercise 7.2.2, the authors want you to create the file used in the example to compare the outputs of a diff command using the -u flag and without it.  The file is a simple "Hello, World" program, very simple to write (just copy and paste into the text editor).  I booted up Ubuntu--I prefer it for my homework in this class because that's the OS we have to use for our projects--and opened up my text editor (gedit) so I could get the program pasted in and saved the file.  I then opened up the terminal window and followed the instructions in the example, which I needed to do before completing the actual exercise.  With that taken care of, I started playing with the diff command as stated in the exercise.  I noticed that without the -u flag, the only output to my terminal window is the original line of the program and the new one that contains the change.  When the command has the -u flag, the output shows where AND when the change was made.  It even prints out the program text with the original and new lines of code--a "-" for the line that will be replaced and a "+" for the new line of text that will be going into the program.  After seeing the outputs for both versions of the diff command, I prefer the one with the -u flag because it contains more information, but I suppose that doing the command without the flag would be more efficient if you have a lot more going on in your terminal window.  I prefer it because I like to know exactly where it is being changed.  On to the next!


7.8:
This exercise says to create a patch file that represents a new file, foo being with the contents bar.  I'm little confused by this one actually.  I wasn't sure if we were supposed to create a patch for the hello.c files or if it was for a different program.  Maybe I'm just being an idiot, I don't know.  Let's hope the last one goes better...


7.9:
This is a step-by-step exercise that wants you to create a patch echo for a project.  I actually really like this one  because I'm a Windows user, so I don't know a whole lot about the bash commands except for what I used last semester in CSCI 362.  Unfortunately, my terminal keeps telling me that the commands I'm trying to use aren't correct, and typing exactly what TOS is telling me to type in the exercise. I don't understand why this is happening.  I did read through the exercise and I'm pretty confident that I understand what's going on.  It's basically a reinforcement of the two previous exercises along with teaching the new concept of creating a working echo binary.

No comments:

Post a Comment