Q1: Are we allowed to use ANSI color codes in the output, or will that mess up the autograder?
\[AV\] - Don't, it may mess up the autograder.
Q2: In the context-free grammar provided:
```
shell_cmd -> cmd_group ((& | &&) cmd_group)* &?
cmd_group -> atomic (\| atomic)*
atomic -> name (name | input | output)*
input -> < name | <name
output -> > name | >name | >> name | >>name
name -> r"[^|&><;]+"
```
There is no mention of `;` used to separate sequential commands. Can we add it like so:
```
shell_cmd -> cmd_group ((; | & | &&) cmd_group)* &?
cmd_group -> atomic (\| atomic)*
atomic -> name (name | input | output)*
input -> < name | <name
output -> > name | >name | >> name | >>name
name -> r"[^|&><;]+"
```
\[AV\] - The grammar has been modified to include the semi-colon and removes the double ampersand.
Q3 Is it necessary to use all the gcc flags as described in the make file, since the -fno-gnu-keywords gives an error when I use it to compile the code? The error is as follows:
```
cc1: error: command-line option ‘-fno-gnu-keywords’ is valid for C++/ObjC++ but not for C [-Werror]
```
\[AV\] - An announcement was made regarding the same. You do not need to use this flag.
Q4: Is it necessary to get the Username and SystemName from syscalls or by reading system files or is it fine to use the Username and SystemName that is found via `echo $HOSTNAME` and `echo $USER`? If it is necessary to use environment variables, as they need to be exported.
\[AV\] - Those environment variables are provided by bash. You should not use information provided by bash. Only use information provided by the system.
Q5. How should whitespaces between commands be dealt with? Are whitespace a part of the command? Whitespace situation needs to be clarified.
\[AV\] - A pure regex version of the grammar has been provided. Check the assignment page.
Q6. For Part A.1 of shell, when I am in shell folder, I run the make file, the executable shell.out is created in the root directory, Mini-Project-1 and not in the shell directory itself, is that correct?
\[AV] - That part of the requirements was created while thinking that the shell directory was the root directory. Please create the executable in the shell directory itself.
Q7. Can we create an object directory when we run make file in shell, so that we have all the .o files there?
\[AV] - Yes you may. However, ensure that the `shell.out` file is created in the main shell directory (i.e. the parent folder of the `src` and `include` folders.)
Q8. for B1 hop the format for error handling is not mentioned what to print when there doesnot exist a folder with the name provided.
\[AV] - Yes, apologies. It has been changed now.
Q9. For the `reveal` command, the syntax is specified as `reveal (-(a | l)*)* (~ | . | .. | - | name)?`. Are we supposed to support the `-` as a valid path, similar to the way it is in `hop`?
\[AV] - Yes, see the requirements before asking questions. (See requirement 5)
Q10. Is > > considered as two '>' or just a single '>>'?
\[AV] - It is two '>'. '>>' is only if there is no space.
Q11. In the `reveal` command, we have been told that "[...] when neither flag is set, print files and directories in the format of ls.". Does this mean we have to split it into columns separated by spaces based on terminal width and max length of a name like native `ls` does? Or can we just print it space separated?
\[AV] - You may do whichever you please.
Q12. In B.1, can the "name" have symbols or can it be a path that does not exist? How to handle invalid syntax?
\[AV] - The "name" refers to the regex which you can see in the CFG in part A3. A requirement for handling an invalid path has been provided. For invalid syntax itself, see part A3.
Q13. In the C shell, the actual current working directory is the virtual home directory for the running C shell? or do we show it as cwd and the actual path from the actual home directory in the C shell?
\[AV] - I do not understand. I will provide an example here that hopefully clarifies the dilemma.
Suppose the path to the shell is `/home/rudy/osn/mp1/cshell/shell.out`. There are 2 cases
1. Our `bash` or `zsh` terminal currently has it's working directory set to `/home/rudy/osn/mp1/cshell`. If we now run `./shell.out`, our shell's home directory will be '/home/rudy/osn/mp1/cshell'.
2. Our `bash` or `zsh` terminal currently has it's working directory set to `/home/rudy/osn/`. If we now run `./mp1/cshell/shell.out`, our shell's home directory will be '/home/rudy/osn/'.
If there is still some confusion, ask a new question.
Q14. In 'hop' command, do the directories have to exist actually or we just add the name to the path?Are the directories real or virtual? Like do we ACTUALLY create the directories or just say that the directory exists without actually creating it?
\[AV] - `hop` does NOT create directories. It merely moves the shell's current working directory. Open `bash` and see what `cd` and `mkdir` do. You are creating a modified version of `cd`. `mkdir` creates directories. Hope that is clear.
Q15. In 'hop' 5th one will the absolute that might be specified will it be absolute from our system root directory or will it be from the directory that we are running the shell code?
\[AV] - Absolute paths are always specified from the system root directory. See the definition of a "resolved path" from `man realpath`.
Q16. In 'hop' if u do '..' this in the new shell home directory so do we have go to its parent or we just dont do anything?
\[AV] - Go to it's parent as mentioned in the requirements. What does `bash` do when you run `cd ..` in the `$HOME` directory? Try running `cd $HOME` and then `cd ..` and see what happens.
Q17. For the `reveal` command, do we have to enable the `-l` option automatically if not writing to stdout, like `ls` does?
\[AV] - You may implement whichever behavior you wish to.
Q18. We are allowed to use `fprintf` to print to `stderr` right?
\[AV] - If it is available in the POSIX C Standard Library you can use it.
Q19. In the example provided for reveal, "<rudy@iiit:~> reveal ~" gives different output and "<rudy@iiit:~> reveal -la" gives different output. Explain please!
```
<rudy@iiit:~> reveal ~
osnmp1
<rudy@iiit:~> hop ..
<rudy@iiit:/home/rudy> reveal
osnmp1
<rudy@iiit:/home/rudy> hop
<rudy@iiit:~> reveal -la
.git
.gitignore
include
llm_completions
src
shell.out
Makefile
README.md
```
\[AV] - That was an incorrect example, it has been fixed now. Apologies for the confusion.
Q20. Only `"` and `'` are allowed or are there other symbols such as `\` for which we take whitespaces as part of the token?
\[AV] - You do not need to implement the behavior of quotes or backslashes.
Q21. Within a set of quotes, are the symbols `&<>|;` allowed as valid token characters.
\[AV] - You do not need to implement the behavior of quotes.
Q22. While compiling the program , if there are multiple .c and .h files , cna we compile them using gcc and mentioning each file name in the command , like
''' gcc -std=c99 \ - D_POSIX_C_SOURCE=200809L \
-D_XOPEN_SOURCE=700 \
-Wall -Wextra -Werror \
-Wno-unused-parameter \
src/main.c src/frgrnd.c \
-o shell'''
for example ?
\[AV] - Yes.
Q23. Can we add an extra wrapper Makefile in the root directory, to execute the individual Makefiles?
\[AV] - Yes.
Q24. Can we give the LLM completions as markdown transcripts rather than images?, because long threads are very hard to take screenshot of
\[AV] - No. Take multiple contiguous screenshots with a slight overlap between each.
Q25.
`The project must be broken down into multiple .c and .h files based on functionality. Monolithic code in a single file will be heavily penalized.`
Is there a set number of c files/h files required to not invoke the penalty? Can we carry out each part atleast in a single file?
\[AV]. As long as there is some amount of modularity, there will be no penalty. The decision to apply the penalty or not will be made by the TA taking your eval.
Q26. If we are ignoring newlines, carriage returns, how are we supposed to know if the user has stopped giving more input?
\[AV] - Assume each user command ends in a newline. You must leave text after the first new line in the input buffer (Hint: a standard library function may already do this).
For example, pasting `"hop ~\n echo hi"` should result in
```
# I copy pasted this here. Note that the \n is only for visualization.
<rudy@iiit:~/osnmp1/> hop ~\n echo hi
<rudy@iiit:~> # Now I press enter
hi ---------> # This runs since " echo hi" was still in the input buffer.
<rudy@iiit:~>
```
Q27. Can we have extra files (like .envrc) or will that mess with the autograder?
\[AV] - You may.
Q28. What is the maximum size of the input we will have to parse on our shell
\[AV] - Assume 4096 characters.
Q29. In case of command1 > output.txt | command2 ; should the output be stored in output.txt and piped to command2 as well?
or according to some POSIX shells, they have stdout from command1 set as output.txt(fd) so command2 receives nothing in stdin via pipe, should we follow this?
\[AV] - See what happens you run the above in `bash`. Or read the GNU documentation for `bash`. Or search stackoverflow. Or ask ChatGPT.
Q30. Do we need to parse &&, << or || in our shell
\[AV] - If it is not specified, it is not required.
Q31. echo hello\ world
if this is the given command, should it be interpreted as echo hello world itself by treating the \ as escape character?
\[AV] - No.
Q32. Are we allowed to use functions like getline, getchar, getc, fscanf etc?
\[AV] - See Q18.
Q33. Upto what length of input (after the shell displays prompt) do we need to account for?
\[AV] - See Q28.
Q33. Do we need to do all the subtasks in a different c file, life for ex. do we need to do A1, A2 and A3 all in different files?
\[AV] - Up to you. See Q25.
Q34. In C Shell,Part C will the commands be normal bash commands like ls,cat or will they be our shell command like hop ,reveal?
\[AV] - Any command, shell intrinsic or not. Note that 'normal bash commands' refers to shell intrinsics (like ls or cd), and that commands like 'cat' or 'echo' are actually compiled binaries in `/usr/bin/`.
Q35. For the log command, do we have to store only hop and reveal commands? If no, then what to do in `log execute <n>` command for those other than hop and reveal?
\[AV] - You must execute any command. Store all commands, including non hop and reveal commands. I recommend implementing `log` after you implement part C.
Q 36 Can we use regex.h
\[AV] - See Q18.
Q37. While logging a command do we need to log complete input, or log commands as they get executed
for eg. say hop ..; reveal -l in this case hop.. and reveal -l should be considered as 2 different commands or a single command.
\[AV] - A single command.
Q38. In command filename X, does it take input from filename and following that executes X as normal argument to the command or is it treated as an error?
\[AV] - I don't understand what this question means.
Q39.(extension of Q13). Apologies for the confusion. I wanted to ask whether the directories "hop" switches to are real or virtual. Like, do we need to actually create the directories in the system, like do file/dir management n all? Or just store in our C shell program that a directory with X name exists?
\[AV] - Firstly, `hop` does not create directories. Secondly
Q40. Do we need it to print Valid and Invalid according to the command groups that have been mentioned in the document so far or according to the command groups in bash?
\[AV] - In the document. See the CFG in part A3.
Q41. Will we be given pipelined/grouped commands to implement or will it only be simple commands?
\[AV] - Yes, see parts C and D.
Q42. What would hello<<boysoutput? Valid or Invalid? the case of << has not been mentioned under the context free grammar
\[AV] - If a command is valid according to the CFG, it is Valid. Else it is Invalid.
Q43. In B.3 "Always store the entire shell_cmd as defined in the CFG".Does this mean we should remove the trailing spaces and the extra spaces??
\[DM] You may store the input command directly as is or without extra spaces as long as on executing it, same command is executed and case of identical previous command is handled aptly.
Q44. (for q38)its command < filename (following that) X. So does it read the input from filename and then X that follows that will be executed as a normal argument or will it be an error?
\[DM] It takes in input from the filename and if the X is a valid argument for that command in CFG it is accepted and if invalid in CFG then error.
Q.45 Are we expected to log the shell commands that end up in a 'Invalid Syntax!' as well?
\[DM] Yes
Q.46
if i have a file structure mp1/shell/src
if i put hop shell what should it show
\[DM] I am assuming you ran makefile in shell directory and ran `./shell.out` in shell directory again, `hop shell` would give "No such file or directory" as **inside** your shell directory(in which you ran ./shell.out), it has directories `src`,`include`, etc but no directory named shell(if there is, then it would hop into it as `~/shell`).
Q47. In the given grammar:
shell_cmd -> cmd_group ((& | ;) cmd_group)* &?
cmd_group -> atomic (| atomic)*
atomic -> name (name | input | output)*
input -> < name | <name
output -> > name | >name | >> name | >>name
name -> r"[^|&><;]+"
it is specified that ">>name" is accepted but it is not specified that "|name" is accepted. So should we not accept cases of the form "|name" and ";name"?
\[AV] - See the assignment web page. It has a regex explaining this.
Q.48 Are we expected to implement hop in the middle of a series of commands in the pipeline? for example:
command 1 | command 2 | .. | hop | .. | command n
\[AV] - See the assignment web page. *Any* command should be supported.
Q.48 is hop - like an undo command? like if I was in the home directory, and then did hop .. went to the previous directory, did hop .. again and went to the prev of prev directory, and then did hop -, it comes to the prev directory. If I now again do hop - will it come back to the home directory or go to the prev to prev directory?
\[AV] - No. `hop -` changes to the previous directory only. To explain your example,
```
<rudy@iiit:~/> hop ..
<rudy@iiit:/home/> hop ..
<rudy@iiit:/> hop - # This will change to /home/
<rudy@iiit:/home/> hop - # This will change to /
<rudy@iiit:/>
```
Q.49 If I am in home directory of shell and do hop .. will it go to the previous directory of the home?
For eg if desktop/miniproject1/shell is my home directory as ~
Doing hop .. will it go to desktop/miniproject1?
\[AV] - Please restrict the doubts document to questions pertaining to actual ambiguities in the assignment. There is a clear example provided in the assignment document which answers this question.
Q.50 The reveal command, when it says lexicographically, is it case sensitive or case insensitive?
\[AV] - See the requirements of the `reveal` command.
Q.51 In A.1 '~'is used to replace actual home directory or the home director we consider for our shell…ex : path/to/home/some/folders/shell_file_here…what is it expected to be ~some/folders/shell_file_here or just ~
\[AV] - See Q13.
Q.52 Should we output invalid syntax if the user inputs just ' ', '\t', '\n' or '\r'?
\[AV] - Follow the assignment requirements. According to them the answer is yes.
Q53. With regards to the answer to Q45 and the guideline "Do not store any shell_cmd if the command name of an atomic command is log itself", are we supposed to log a command with invalid syntax that contains log?
\[AV] - Yes. If the syntax is invalid, we cannot say that the command contains log as an atomic command.
Q.54 If I have multiple redirections like grep hi < input1.txt < input2.txt and more than one of them do not exist, do I print the error message only for the last one or for all?
\[AV] - Follow the behavior of bash for all such doubts.
Q.55. What is the final directory for the following sequence of steps (assume initial directory was '~', and that "~/mini-project" exists).
$ hop mini-project
$ hop ..
$ hop .
$ hop -
Will it be: '~' or "mini project"? I.e. does the '.' cause the previous directory to become the current directory, or does it not modify the history at all?
\[AV] - It does modify history. Follow the behavior of bash (`cd`) for similar doubts.
Q 56. In reference to Q13's answer when I have just opened the shell and I am in the home directory if I do hop .. on the former Part 1 explanation given should it display the path as:
/home/
or /home/rudy/osn/mp1
Also are we suppsed to support commands like "hop ~/Downloads/xyz" when I am in any directory that is not a path to home?
\[AV] - For the first question, follow the behavior of bash. FOr the second question, you do not have to.
Q57. Are commands like 1)reveal -lala - myfolder 2)reveal - - -lala 3)hop ~ .. 4)hop - ~ - ~valid? They seem to be valid as per the grammar but are otherwise meaningless. Also if valid, what should we implement for command 3) and 4) here?
\[AV] - There is a difference between *syntax* and *semantics*. Those commands are *syntactically* valid, but not *semantically* valid. In other words, those follow the rules of our shell language, but they do not mean anything.
I do not understand this. There are examples in the assignment document that answer your second question. Why is the document not your first source to clear ambiguities?
Q58. Is the makefile supposed to be in the root directory of the repo, or in the shell folder? Cause "Your final code submission must be compilable using the command make all in the root directory of the git repository" means that the Makefile shouldn't be in the Shell folder unlike what the directory structure mentions, as we wouldn't be able to run the make command from the root then.
\[AV] - Thank you, that was an ambiguity. The makefile should be in the shell folder. The assignment page has been updated.
Q59. Is executing execvp allowed? I.e is using the PATH defined by bash allowed?
\[AV] - It is not. I have now explicitly mentioned it in the assignmnet doc.
Q60. C.1: Command Execution
This part was implicitly required, and has just been added explicitly for clarity. You must allow the execution of arbitrary comands. This includes commands like cat, echo, sleep, etc.
this was the question of C1. What does arbitrary exactly mean, it would be better if you could actually specify the exact list of commands that are required
\[AV] - Perhaps it would be better if you could Google the meaning of arbitrary. In particular, look at the 3rd meaning. A question for you - do you think bash/zsh/etc. have a list of *all* possible commands that exist so that they can check for syntax errors?

Q61. What is the maximum number of subdirectories and files that can be present in a directory?
\[AV] - I don't see how this is relevant, but it depends on your filesystem (ext4, ntfs, etc.).
Q62. How to handle the case when reveal gets too many arguements or an invalid flag?
\[AV] - In the case of too many arguments, the assignment has been modified. In the case of an invalid flag, consider that "-meow" is a valid file/dirctory name. Does that answer your question?
Q63. How do we handle the case in reveal command when there is no previous directory i.e. the hop command hasn't been executed?
\[AV] - Thank you, that was ambiguous. The assignment doc has been modified.
Q64. Do not store a command if it is identical to the previously executed command in the log. Here identical can mean syntactically or exactly. Take it to mean exactly.
could you give an example what exactly means
\[AV] - "echo hi;hop .." is syntactically identical to "echo hi ; hop ..", but the exact command string is different due to whitespace. Do not store a command if it is exactly identical to the string of the previous command.
Q65. Requirements for Ctrl-Z (SIGTSTP): The shell must move the stopped process to the background process list with status “Stopped”.
Requirements for fg command:The command must bring a background or stopped job to the foreground.
Aren't these two statements contradicting each other? should a stopped process move to the background or foreground?
\[AV] - Those statements do *not* contradict each other.
Q66. For the log command, is it okay if the commands are stored in a file? does the file have to be gitignored before submission or can it exist inside the source files?
\[AV] - It is up to you if you wish to gitignore it or not.
Q67. ├── xv6/
│ ├── xv6_modifications.patch
│ ├── readcount.c
│ └── report.md # Or report.pdf
What is xv6_modification.patch, do we put the whole xv6-riscv codebase there or what exactly?
\[PJ] Submit both the xv6 code as a zip file as well as generate a patch file using `git diff` and submit it.
Q68. Should background job notifications ([job_number] process_id) be printed to stdout or stderr when a background job is started? According to last test of the script it shouldn't as it's expecting only "Hi There!" but shouldn't the errors or completetion go to stdout/stderr acc to the requirements?
What is s
\[AV] - Output to stderr.
Q69. Are shell intrinsics (builtin functions like hop, reveal, log) backgroundable processes? like should they support `&` ?
\[AV] - Yes.
Q70. How are we supposed to handle commands like "ls -l > file1.txt file2.txt", basically where there is a name variable after an input/output variable, specify the same for the command defined in the project?
Also for the commands mentioned in the assignment, none of them accept input from a file, so what to do if the user tries to pass some info to it?
\[AV] - `ls` is not a command in our shell, so I am assuming you are talking about `reveal`. Why don't you read the syntax and points 7 and 8 for `reveal`? Are the requirements really that incomprehensible? If that is the case, please mail me and meet me.
Q71. Can we use #define _GNU_SOURCE for using the HOST_NAME_MAX length in 1st question? Or, should we just use 256 as the length?
\[AV] - No you cannot use that. Just use 256.
Q72. "If a background command in a sequence is followed by more commands (e.g., cmd1 & cmd2), only cmd1 runs in the background."
does that mean cmd2 is not executed at all?
\[AV] - Note that it says "only cmd1 runs in the **background**" and does **not** mention that cmd2 is not executed.
Q73. If the user enters a command that is not recognized by the shell (say a random sentence), how is our shell expected to behave?
\[AV] - Good question. I have updated part C.1.
Q74. Do flags need to be separated by a space, is "reveal -l-a" valid?
\[AV] - Yes they need to be separated by a space. That is invalid.
Q75. What is the purpose of output_file_name specified as an argument while executing client.c? It is not specified in the document that server needs to use this specific filename for output, so do we need to send a packet containing the same?
[ES] - The file should be saved by that name in the server, its implementation is upto you
Q76. Does it matter where we print the errors? Like, do we do print the errors to stdout or stderr? Will the choice affect the autograder?
\[AV] - Print errors to stderr.
Q77. In the example provided for reveal, the sorting used is not lexicographical according to ASCII ??
```
<rudy@iiit:~/osnmp1> reveal -la
.git
.gitignore
include
llm_completions
src
shell.out
Makefile
README.md
```
\[AV] - Apologies, it has been updated.
Q78. When we use hop we have to do
```If the directory does not exist, output “No such directory!```
But what errno is set for such an error?? Or do we print "No such directory!" for all errors. Part of man page of chdir for reference:
```
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set to indicate the error.
ERRORS
Depending on the filesystem, other errors can be returned. The more general errors for chdir() are listed below:
EACCES Search permission is denied for one of the components of path. (See also path_resolution(7).)
EFAULT path points outside your accessible address space.
EIO An I/O error occurred.
ELOOP Too many symbolic links were encountered in resolving path.
ENAMETOOLONG
path is too long.
ENOENT The directory specified in path does not exist.
ENOMEM Insufficient kernel memory was available.
ENOTDIR
A component of path is not a directory.
The general errors for fchdir() are listed below:
EACCES Search permission was denied on the directory open on fd.
EBADF fd is not a valid file descriptor.
ENOTDIR
fd does not refer to a directory.
```
\[AV] - Sure.
Q79. What is the maximum number of background processes that we are expected to handle simultaneously?
\[AV] - 4194303.
Q80. Is this correct regex for reveal command??
```^reveal(?:\s+-(?:[al]+))*(?:\s+(?P<dir_name>[^|&><;]+))?$```
\[AV] - `r"reveal(P<WS>\s+)(-[al]+)*(~|\.|\..|-|(?P<NAME>[^|&><;]+))"`
Q81. I have a similar doubt to q55 but a different function. If I carry out these in the hop function
```
desktop/osnmp> hop src
desktop/osnmp/src> hop ~
/~> hop -
```
then will the path be "/~" only (as it was previous) or it will be desktop/osnmp (as maybe ~ won't change the history ?)
\[AV] - As the answer for Q55 says, "Follow the behavior of bash (`cd`) for similar doubts.".
Q82. If my command is hop ..|reveal should i change the current directory bcz in normal bash the cd .. | ls will not change the directory and list the files in the current directory
\[AV] - Up to you. Tip - it is easier to do the bash way.
Q83. Adding onto the previous question, since we are supposed to fork for a background process as well, as per the requirements, do the changes made by the hop command persist?
[
\[AV] - If hop is run in the background, it shouldn't modify the working directory of the shell.
Q84. In 1.3 part of networking, there is a mention of sender and receiver. Can I safely assume, sender is client and receiver is server always?
[ES] - In the file transfer mode yes but in chat mode both the server and client should be able to send messages to each other.
Q85. In Data Sequencing and Retransmission part of networking, for the sliding window part, there is no fixed window_size mentioned, can we take any of our choice?
[ES] - Yes, you can choose your own
Q86. What should `activities` output on the following:
`ls | grep file_name &`
1. `[pid] : grep file_name - Running` or
2. `[pid] : ls | grep file_name - Running`
\[AV] - The second.
Q87. For Networking, we're supposed to build on top of UDP so is it alright to use the code provided in a w boilerplate?
[ES] - Yes
Q88. Related to Q86, when `ls | grep file_name &` finishes, does part D (Background execution) print
1. `ls | grep file_name with pid <pid> exited normally` or
2. `grep file_name with pid <pid> exited normally`
\[AV] - The first.
Q89.
`atomic -> r"(?P<NAME1>[^|&><;]+)(?P<WS1>\s+)((?P<NAME2>[^| &><;]+)|(?P<input>.+)|(?P<output>.+))*"`
`name -> r"[^|&><;]+"`
According to the regex of **name** it can consume whitespaces.
In the first named capture group **NAME1** of **atomic**, if it consumes spaces, how will we ever check whether **WS1** was able to capture spaces?
\[AV] - Thanks, that was a mistake, the regex has been updated.
Q90. Are commands having multiple < and > allowed ? or we only have to handle this occurence - < > ?
\[AV] - If the CFG says it is allowed, it is.
Q91. Should the input and output redirection also work for the hop and reveal commands? Also should the pipe symbol also work with hop and reveal?
\[AV] - Yes.
Q92. How are we expected to handle the case when the activities list is empty - either on initialisation or when all the processes have been terminated?
\[AV] - Output nothing.
Q93. If any command has invalid syntax, say for eg log log, should we accept it just like we are accepting any other string which is not a command as it passes the parser or should we print invalid syntax?
\[AV] - It is valid syntax, but invalid semantics. See part C.1.
Q94. How to respond if the user enters invalid signal number with the ping command?
\[AV] - Print "Invalid syntax!"
Q95. The regex version of the grammar says that no trailing whitespaces are to be considered but some answered questions suggest that it is allowed. So do we consider trailing whitespaces at the start of the input or just skip them (eg. 'input' is allowed but ' input' is not)
\[AV] - Whitespace is allowed at the beginning and the end.
Q96. Will there be an automated code run for networking as well, as there is no real format given for error handling, or handling of some cases of how the client and server shld behave in certain instances, like say when the client starts but not the server, should the client terminate saying unable to connect to server or just keep waiting for a given time period until the server responds.
[ES] - There will be no automated testing in the networking part
Q97. For the log command should log any sequential command that has a log command in it? eg: cat input.txt ;log ; echo hi
\[AV] - See point 5 of B.3.
Q98. How should we deal with the whitespaces in the front?
For example, if I execute " hop .." , should it give the same output as `hop ..`
\[AV] - See Q95.
Q99. `Do not store a command if it is identical to the previously executed command in the log`. Just to be clear, this means that we only have to check if only the LAST command was same, and NOT the rest of 14 commands, right?
\[AV] - Yes.
Q100. should ```reveal name -a``` result in a syntax error?
\[AV] - Read the requirements, it is clear.
Q101. ```If the file does not exist or cannot be opened, the shell must print “No such file or directory” and not execute the command.```
This is specified for C2. For C3, what should we print if there's an error in opening the output file?
\[AV] - The requirements have been modified.
Q102. Activation: The logging mode must be activated by setting an environment variable RUDP_LOG=1. If this variable is not set, no log file should be created or written to.
in Networking part, what does this mean? what I am doing is put smtg like this on terminal RUDP_LOG=1 ./client 127.0.0.1 8080 input_test.txt output.txt, and then the client_log.txt is automatically created and logs are sent in the format given in assn, similarly I am setting that variable in terminal before running server code, and it creates server_log.txt. Is that correct, or should that variable be set smwhere in the code itself?
Q103. So, the index of job number being assigned by Bash for background processes is reset after all background processes has been terminated and printed on terminal. Do we also need similar behaviour in our shell, or reseting it only for a new session will be fine??
```
username@hostname:~/Desktop$ sleep 2 & sleep 2 &
[1] 149923
[2] 149924
username@hostname:~/Desktop$
[1]- Done sleep 2
[2]+ Done sleep 2
username@hostname:~/Desktop$ sleep 2 &
[1] 149926
username@hostname:~/Desktop$
```
\[AV] - Either works.
Q104. "If the file does not exist or cannot be opened, the shell must print “No such file or directory” and not execute the command." Apart from this message can the program additionally also display perror message like Failed to execute command or something like that or would it fail in the autograder if such a case arises?
\[AV] - It would likely be ok, but for my convenience (yes, I am also a person 🥲) please don't.
Q105. For the log command in C shell, are we supposed to store the command history in a file or in some data structure in the programm itself?
\[AV] - You can do whatever you want as long as the requirements are met.
Q106. For the log command in C shell, do we need to store the command logs across different shell sessions? Like, say a ran 1st session, punched in few commands, terminated the program, ran it again, and entered log command, so should it show logs from the previous session or an empty file?
\[AV] - Guess what B.3 requirement number 1 says!
Q107. cat < nonexistent.txt < hello.txt Should this command print the contents of hello.txt on terminal or raise an error as the file nonexistent.txt doesn't exist?
\[AV] - Guess what C.2 requirement number 2 says!
Q108. "If any command in the pipeline fails to execute, the pipeline must still attempt to run the remaining commands." So it should be printing the error message and then the result of the following commands in the pipeline, right?
\[AV] - Yes, but you aren't the one who must print the error message. Note that here the requirement is referring to the _command itself failing_, and not a syntax error.
Q109. Are we supposed to log inputs with invalid syntax/failed execution? If yes, then how shall ```log execute <i>``` as an atomic command in the input behave if the i_th command in the history resulted in an invalid syntax? [where the input could be ```command1 | log execute i | command2```]
\[AV] - Imagine `log execute <i>` to essentially just be replaced by the i'th command in the history. (So it would result in a command whose syntax is invalid and I think you know what to do then)
Q110. How exactly are we expected to do part C? Are we allowed to invoke bash in the case of say "echo "hello world" "
\[AV] - Um no you aren't allowed to invoke bash. Maybe ask ChatGPT. Or perhaps Google if you guys still remember that thing.
Q111. When Ctrl D is pressed, is it expected that the current process will terminate or is it pressed when the shell is taking the input?
\[AV] - It should be pressed when the shell is taking input. To make it easier on y'all, it will only be pressed when there is no prior input already typed.
Q112. When a pipeline process is running, should the activities command display the whole pipeline as a single entity or each process individually in the pipeline?
Q113. If no job number is passed to the bg command, is it expected to handle the most recent job number?
\[AV] - If it is not required, it is not expected.
Q114. If I execute
`hop ~` and then `hop .. -`, for `-` command, is the previous directory that we should move to considered as the directory before executing `..` or the one before executing `~`
\[AV] - The one before executing `..`. It always moves to the last visited directory, regardless of when that directory was visited (in a previous command or in the same one).
Q115. In the three way handshake the client has to send an ACK in response to a SYN-ACK received from the server, but there is no log specification for that (ideally SND ACK FOR SYN). What to do in this case?
[ES] - In the assignment, the given example is for the server log. A similar log file should be created for the client as well. As long as you can clearly show what is happening at each step in the log file you will get marks
Q116. Are piped commands supposed to run parallely or running them sequentially is okay?
\[AV] - They need to run parallely.
Q117. If a command is not found (e.g., I run `non-existent-command`), what is the expected output? Is printing "Command not found" okay?
\[AV] - See requirement C.1.
Q118. Can we run the intrinsic shell commands ("hop", "reveal", "log") in child processes? (But to actually run those commands, I won't be using any exec system calls as "exec system calls are BANNED for PART B")
\[AV] - You may do whatever you wish to as long as the requirements are satisfied and no banned system calls are used.
Q119. Is hop .. .. - same as staying in the same directory or hop .. ?
\[AV] - There are sufficient questions and answers above to answer this.
Q120. If we run log <invalid command>, should we print nothing or should we print an error message of some sort?
\[AV] - Yes. Apologies, I could have sworn I updated that in the requirements :/.
Q121. If we give an input redirection to log, should it print an error message?
\[AV] - No.
Q122. if a valid log command is in a pipe or sequential input, then will that input be stored in the logs as is? Will it be stored be stored, but log command removed from between the pipes/sequence, or will it not be stored at all?
\[AV] - Please give me an example of what you are saying, though if it is what I think it is, the requirements answer this.
Q123. Extra logs for network part won't be a problem correct?
Q124. In part D2, what defines an abnoraml exit, ie is "ls fakefile &" supposed to give normal or abnormal because it did throw an error but also the program exits noramlly using exit()
\[AV] - Guys you need to learn to use Google :/.
Q125. Should we store the log command that is part of a sequential command eg: echo hi; log (or) log;echo hi
\[AV] - Requirement 5 says - "Do not store any shell_cmd if the command name of an atomic command is log itself.". Perhaps you should read the document.
Q126. The last test case, in the testing script given on moodle, is:
expected = "Hi There!"
sleep 10 & echo {expected} > test.txt; cat test.txt
Expected Output: "Hi There!\r\n"
Aren't we supposed to print job number and process ID for "sleep 10 &"? (Part D2, Requirement 2)
\[AV] - Yes, you are. You may ignore that for now, it has already been changed in the final testing script. Thanks for pointing it out.
Q127. In relation to Q57, should a command like hop .. .. .. .. ~ / execute? As in the test script this executes to give / as the directory, but according to Q57 this isnt a vaild command. In case this isnt a vaild command, what should happen? Else if this is a valid command, are .. .. .. .. ~ / being executed in sequence, or is only the last one being executed?
\[AV] - Read the answer to Q57 again. Those are valid commands. Maybe read the requirements for hop as well.
Q128. Can we assume the commands fg and bg will never be used in a pipeline? Also can log execute/log purge/log be used in a pipeline? Can you specify for each form of log?
\[AV] - You may not assume any of those things. Any shell intrinsic can be used anywhere.
Q129. Do we also have to include the screenshot of the llm chat even if we just learnt something or asked about a concept? or just the llm generated code block's screenshots?
\[AV] - The code and the prompt directly resulting in the generation of that code is sufficient.
Q130. For background execution, if the & symbol is after a pipeline, say
cmd1 | cmd2 | cmd3 | cmd 4 &
then does only cmd4 become a background process or the entire pipeline?
\[AV] - See how this is implemented in bash. But to answer your questions, yes, the entire pipeline is a background process.
Q131. Since readcount() system call will be implemented in the xv6 directory, how are we supposed to push the project to github including the xv6 directory? Can the directory structure for the xv6 part be mentioned? Please also mention the marks split for the xv6 part, as part A has not marks assigned to it, and it is ambiguous whether the bonus part for 25 marks is included in the 140 or excluded from it.