The goal of this homework assignment is to allow you to practice using common development tools such as git, curl, gcc, make, gdb, and valgrind in a Unix programming environment.

For this assignment, you are to do your work in the homework01 folder of your assignments GitHub repository and push your work by noon Wednesday, August 30.

Activity 0: Branching

As discussed in class, each reading and homework assignment must be completed in its own git branch; this will allow you to separate the work of each assignment and for you to use the Pull Request workflow describe in Reading 01.

To create a homework01 branch in your local repository, follow the instructions below:

$ cd path/to/cse-20312-fa23-assignments   # Go to assignments repository

$ git switch master                       # Make sure we are in master branch

$ git pull --rebase                       # Make sure we are up-to-date with GitHub

$ git checkout -b homework01              # Create homework01 branch and check it out

$ cd homework01                           # Go into homework01 folder

Once these commands have been successfully performed, you are now ready to add, commit, and push any work required for this assignment.

Activity 1: Co-Pilot (10 Points)

The main activity for this assignment is to follow the prompts of your Co-Pilot, which takes the form of a program located at:

https://www3.nd.edu/~pbui/teaching/cse.20312.fa23/static/txt/COPILOT

You can use either curl to download this program to your homework01 folder in your assignments repository and execute it as follows:

# Go to homework01 directory in assignments repository
$ cd path/to/assignments/homework01

# Download COPILOT
$ curl -LO https://www3.nd.edu/~pbui/teaching/cse.20312.fa23/static/txt/COPILOT

# Make COPILOT executable
$ chmod +x COPILOT

# Run COPILOT
$ ./COPILOT
...

As you can see in the demonstration video below, the COPILOT script will prompt you to complete a series of tasks (13 in total). After you complete each task, you must run the COPILOT script so it can verify your work. If it detects that you have completed the task, it will update the tasks.yaml file with a specially encoded checkpoint payload associated with your netid and the corresponding task. It will then prompt you with the next task.

You are to follow the prompts specified by the COPILOT until you have completed each of the tasks in the adventure. Because some tasks depend on others, there is no skipping ahead or going backwards. That said, you can always remove the checkpoints in the tasks.yaml file to go back to a particular task.

At the end of this activity, you should see the following output from the COPILOT:

$ ./COPILOT
Checking homework01 tasks ...
 Task 00 Checkout on homework01 branch            ... Completed
 Task 01 Download file                            ... Completed
 Task 02 Modify Makefile - Build                  ... Completed
 Task 03 Modify Makefile - Clean                  ... Completed
 Task 04 Trace - Warnings                         ... Completed
 Task 05 Trace - GDB                              ... Completed
 Task 06 Fix segfault                             ... Completed
 Task 07 Redirection - Input                      ... Completed
 Task 08 Trace - Valgrind                         ... Completed
 Task 09 Fix error                                ... Completed
 Task 10 Quiz                                     ... Completed
   Score 12.00 / 12.00
  Status Success

Task Checkpoints

Note, that each task checkpoint in the tasks.yaml is specially encoded for your netid. This means that copying the checkpoint from another student or from a previous task will not work and will lead to a corruption warning that will anger the COPILOT. The only way to proceed through the activity is to actually do the tasks!

References

If you need additional reference information, please refer to the readings from Reading 00 along with the following:

  1. Beej's Quick Guide to GDB

  2. Valgrind Quick Start Guide

  3. Systems Programing - Memory Mistakes

Activity 2: Quiz (2 Points)

Once you have completed all the tasks specified by the COPILOT in Activity 1, you are to complete the following reflection quiz:

As with Reading 01, you will need to store your answers in a homework01/answers.json file. You can use the form above to generate the contents of this file, or you can write the JSON by hand.

To check your quiz directly, you can use the check.py script:

$ ../.scripts/check.py
Checking homework01 quiz ...
      Q1 0.70
      Q2 0.50
      Q3 0.30
      Q4 0.50
   Score 2.00 / 2.00
  Status Success

Leet Point (1 Extra Credit Point)

For extra credit, you are to customize your favorite $EDITOR by adding useful programming or development extensions and plugins that will make your Unix programming environment more productive. Here are some sources of inspiration:

Nano

Vim

Emacs

VS Code

If you come across any other tutorials or resources, please share them on Slack.

Verification

To get credit for this Leet Point, show your text editor customizations to a TA to verify (or attached a video / screenshot to your Pull Request). You have up until two days after this assignment is due to verify your Leet Point.

Self-Service Extension

Remember that you can always forgo this Leet Point for two extra days to do the homework. That is, if you need an extension, you can simply skip the Leet Point and you will automatically have until Friday to complete the assignment for full credit.

Just leave a note on your Pull Request of your intentions.

Submission

To submit your assignment, please commit your work to the homework01 folder of your homework01 branch in your assignments GitHub repository:

$ cd path/to/cse-20312-fa23-assignments     # Go to assignments repository
$ git checkout master                       # Make sure we are in master branch
$ git pull --rebase                         # Make sure we are up-to-date with GitHub
$ git checkout -b homework01                # Create homework01 branch and check it out
$ cd homework01                             # Go to homework01 directory
...

$ git add Makefile                          # Mark changes for commit
$ git add COPILOT                           # Mark changes for commit
$ git add tasks.yaml                        # Mark changes for commit
$ git add sum.c                             # Mark changes for commit
$ git commit -m "Homework 01: Activity 1"   # Record changes
...

$ git add answers.json                      # Mark changes for commit
$ git commit -m "Homework 01: Activity 2"   # Record changes
...

$ git push -u origin homework01             # Push branch to GitHub

Pull Request

Remember to create a Pull Request and assign the appropriate TA from the Reading 01 TA List.

DO NOT MERGE your own Pull Request. The TAs use open Pull Requests to keep track of which assignments to grade. Closing them yourself will cause a delay in grading and confuse the TAs.