Skip to content

Conversation

@aryianj
Copy link

@aryianj aryianj commented Sep 26, 2025

This pull request addresses issue #8. Not only does it add a birthday command, but it also adds a date command.

Birthday is a command that must be set before calling with valid parameters 'birthday -s MM/DD'. After the command is set, simply type 'birthday' and you will either receive a happy birthday message with ASCII art from https://www.asciiart.eu/ or a message saying its not your birthday yet.

Date is a singular command. Type 'date' and you will receive today's date in format MMM DD HH:MM:SS PDT YYYY. MMM is a string.

Documentation and testing suggestions can be found in docs/birthday-date.md

@natyhl
Copy link

natyhl commented Oct 2, 2025

I’m reviewing this PR.

Copy link

@natyhl natyhl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun feature and great idea! You could add a --help flag wit brief description of what "birthday" does.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe try to make the .md file more organized and easy to read

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: could handle wrong format input

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date has a weird formatting:
Screenshot 2025-10-01 at 9 05 25 PM

aryianj and others added 3 commits October 3, 2025 16:52
Updated the birthday and date command documentation for clarity and added examples.
@jadecuster
Copy link

I'm reviewing this PR

@jadecuster
Copy link

I think this is a really cool concept to add a birthday command. Just as a heads up in birthdaytest.c line 19 it looks like the comment got cut off (" return status; // status = childs exit numbe") I'm assuming you meant to state number, but cleaning that up would be great! Otherwise super clean and you did an amazing job!

@yifanwane
Copy link

yifanwane commented Oct 11, 2025

1️⃣ Verification — Requirements & Functionality

Purpose:
The birthday utility allows users to view or set a birthday. When the system date matches the saved one, the program prints an ASCII-art celebration; otherwise it notifies the user that it is not their birthday yet.

Core features checked:

birthday --help → Shows usage information.

birthday -s MM/DD → Sets birthday (accepts valid dates).

birthday → Displays either “Happy Birthday!” or “Uh oh, it’s not your birthday yet :(”.

Handles missing or invalid arguments by showing usage text.

System date retrieved properly via date.

✅ All functional requirements are implemented and operate as intended under normal conditions.

2️⃣ Testing — Behavior and Edge Cases

Test Case Command Expected Result Observed Result Status
✅Help display
✅Unset birthday
✅Set birthday
✅Matching date
✅Non-matching date
✅Invalid format
⚠️Repeated runs Multiple calls with -s 10/10 Consistent output Occasional exec birthday failed ⚠️ Intermittent error
✅System integration

Summary:
The command is fully functional but exhibits an intermittent runtime failure after repeated use of birthday -s MM/DD.
The error message exec birthday failed appears sporadically and then self-recovers on subsequent runs, indicating a transient memory-level issue rather than a permanent filesystem corruption.

3️⃣ Issues Identified & Possible Causes
⚠️ Issue 1 — Intermittent exec birthday failed

Description:
After setting the birthday with -s MM/DD, the next invocation occasionally fails to execute (exec birthday failed) before working again.

Observed Pattern:

Error appears randomly after 1–3 consecutive runs.

Later executions succeed without recompilation.

The executable file remains intact (ls shows same size).

Possible Root Causes:

Stack or buffer overflow when copying the MM/DD string in the -s path (e.g., fixed-length array too small or missing '\0').

Memory corruption of argv/cmd buffer in user space that temporarily breaks shell command execution.

Less likely but possible minor race between file writes and shell read of the same block in the xv6 filesystem.

Severity: Moderate — does not affect functionality persistently but shows unstable memory behavior.

Suggested Fix (Conceptual): Use safe string functions such as strncpy or snprintf, allocate enough space for null terminators, and validate input length.

⚠️ Issue 2 — No Confirmation After Setting Birthday

When using birthday -s MM/DD, the program provides no explicit feedback that the date was stored.
Impact: Minor usability issue.
Recommendation: Print confirmation (e.g., Birthday set to 10/10).

⚠️ Issue 3 — Input Validation

Invalid dates (e.g., 13/40) are not accepted which is good, but without warning, only Usage: displays.
Impact: Low, but can produce nonsensical results.
Recommendation: Add simple range checks for month/day.
When you put Invalid dates, issue 1 occurs as well.
Recommendation: Print warning.

4️⃣ Code Walkthrough — Logic & Readability

Argument handling is clear and well structured.

Output strings and help messages are user-friendly.

ASCII art output is neatly formatted and adds creativity.

Code is easy to read, though some string handling is likely unsafe.

No explicit comments describe the storage mechanism or input length limits.

Improvement Suggestions:

Add inline comments around argument parsing and birthday setting logic.

Use constants for buffer sizes and date formats to avoid magic numbers.

5️⃣ Final Checklist

Item Status Notes
PR resolves task/issue Implements all requested features
Tests performed Manual and repeated runtime tests done
Follows code formatting Matches CS 326 standards
OS builds and runs make qemu successful
Documentation included Help and usage messages present
Item Status Notes
Achieves intended purpose Meets functional spec
Edge cases considered ⚠️ Intermittent runtime bug under repeated use
Code organization & maintainability Readable structure
Performance regression No impact detected
Runtime stability ⚠️ Occasional exec failure observed

Reviewer Summary

The birthday command successfully meets its functional requirements and runs within FogOS without crashes in normal use.
However, intermittent execution failures (exec birthday failed) were observed after repeated invocations of the -s flag, suggesting a possible memory-safety issue in string handling.
The program remains usable and recovers immediately, but future revisions should address safe buffer management and add user feedback for setting birthdays.

@malensek
Copy link
Contributor

I like this idea, it's a fun project.

There are two different "usages", you should just have one.

For the --help flag, maybe either add an implementation of strcmp so you don't need to check each char manually, or reconfigure it so the flag is just -h.

4.9/5

+0.1 -> minor fixes above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants