4820 p1 milestone 3 memory check

4820 p1 milestone 3 memory check

You cannot submit for this problem because the homework's deadline is due.

Final Pretest

Memory leaks and undefined behaviors are tested here but not counted into grade.

Hint: LeakSanitizer is unstable. You may ignore the cases when it meets fatal error.

Tasks

12. Handle errors for all supported features. [10]

  • Case: 1-8
  • At most one of these error occurs in a command
  • Non-existing program (Case 1)
    • input: non-exist abc def
    • input: echo abc | non-exist
    • output: non-exist: command not found
  • Non-existing file in input redirection (Case 2)
    • input: cat < non-existing.txt
    • output: non-existing.txt: No such file or directory
  • Failed to open file in output redirection (Case 3)
    • input: echo abc > /dev/permission_denied
    • output: /dev/permission_denied: Permission denied
  • Duplicated input redirection (Case 4)
    • input: echo abc < 1.txt < 2.txt
    • input: echo abc | grep abc < 1.txt
    • output: error: duplicated input redirection
  • Duplicated output redirection (Case 5)
    • input: echo abc > 1.txt > 2.txt
    • input: echo abc > 1.txt >> 2.txt
    • input: echo abc > 1.txt | grep abc
    • output: error: duplicated output redirection
  • Syntax Error (Case 6)
    • input: echo abc > > > >
    • output: syntax error near unexpected token `>'
    • input: echo abc > < 1.txt
    • output: syntax error near unexpected token `<'
    • input: echo abc > | grep abc
    • output: syntax error near unexpected token `|'
  • Missing program (Case 7)
    • input: > abc | | grep 123
    • output: error: missing program
  • cd to non-existing directory (Case 8)
    • input: cd non-existing
    • output: non-existing: No such file or directory

4820 p1 milestone 3

Not Claimed
Status
Finished
Problems
6
Open Since
2022-09-19 00:00
DDL
2022-10-16 23:59
Extension
72.0 hour(s)