Open WSSMRKS opened 1 week ago
@kjzl Did you change something in the parser? those commands are not coming through to the executor anymore. Bash is giving these commands through and then executing creating or checking for the files. Implement or leave as is? For me both is fine.
Example:
wssmrks@wssmrks-desktop:~/coding/42_minishell$ <in1
bash: in1: No such file or directory
wssmrks@wssmrks-desktop:~/coding/42_minishell$ cat >in1
this is a file
wssmrks@wssmrks-desktop:~/coding/42_minishell$ <in1
wssmrks@wssmrks-desktop:~/coding/42_minishell$ >out
wssmrks@wssmrks-desktop:~/coding/42_minishell$ >>out2
wssmrks@wssmrks-desktop:~/coding/42_minishell$ ls -al
total 640
drwxrwxr-x 8 wssmrks wssmrks 4096 Nov 25 16:08 .
drwxrwxr-x 5 wssmrks wssmrks 4096 Nov 25 13:10 ..
drwxrwxr-x 8 wssmrks wssmrks 4096 Nov 25 15:59 .git
-rw-rw-r-- 1 wssmrks wssmrks 273 Nov 17 21:28 .gitignore
drwxrwxr-x 2 wssmrks wssmrks 4096 Nov 18 23:44 .vscode
-rw-rw-r-- 1 wssmrks wssmrks 3067 Nov 21 18:13 Makefile
-rwxrwxr-x 1 wssmrks wssmrks 514 Nov 18 23:44 create_rl_suppressions.sh
drwxrwxr-x 2 wssmrks wssmrks 4096 Nov 25 15:58 headers
-rw-rw-r-- 1 wssmrks wssmrks 15 Nov 25 16:07 in1
drwxrwxr-x 18 wssmrks wssmrks 4096 Nov 25 16:04 libft
-rwxrwxr-x 1 wssmrks wssmrks 575496 Nov 25 16:04 minishell
-rw-rw-r-- 1 wssmrks wssmrks 0 Nov 25 16:08 out
-rw-rw-r-- 1 wssmrks wssmrks 0 Nov 25 16:01 out1
-rw-rw-r-- 1 wssmrks wssmrks 0 Nov 25 16:08 out2
drwxrwxr-x 7 wssmrks wssmrks 4096 Nov 17 21:28 src
-rw-rw-r-- 1 wssmrks wssmrks 54571 Nov 18 23:44 suppressions.supp
-rw-rw-r-- 1 wssmrks wssmrks 1968 Nov 25 12:36 testcases
drwxrwxr-x 2 wssmrks wssmrks 4096 Nov 21 18:13 tests
wssmrks@wssmrks-desktop:~/coding/42_minishell$
Crashes with input without actual commands was fixed by commit 1503cdc. The parser returns NULL for input without a command to be run. Do we need to change this?
@WSSMRKS
If we want to exactly rebuilt bash yes we need to change. Then a command like ">P1 >P2 >P3" would solely create the files And a command like "<In1 <In2" would only check if the files are there.
@kjzl What do you think?
Tracked by #57
Segfault when redirects without commands.
wssmrks@MarkusPC:~/42_minishell$ ./minishell minishell$ <in1 Segmentation fault (core dumped) wssmrks@MarkusPC:~/42_minishell$ ./minishell minishell$ <in1 <in2 <in3 Segmentation fault (core dumped) wssmrks@MarkusPC:~/42_minishell$ wssmrks@MarkusPC:~/42_minishell$ ./minishell minishell$ <in1 Segmentation fault (core dumped) wssmrks@MarkusPC:~/42_minishell$ ./minishell minishell$ <in1 <in2 <in3 Segmentation fault (core dumped) wssmrks@MarkusPC:~/42_minishell$ ./minishell minishell$ >o1 >o2 >o3 Segmentation fault (core dumped) wssmrks@MarkusPC:~/42_minishell$ dir Makefile headers ms_behavior.txt test todo create_rl_suppressions.sh libft src test_chdir.c todo.txt design_choices.txt minishell suppressions.supp testcases wssmrks@MarkusPC:~/42_minishell$ ./minishell minishell$ >o1 Segmentation fault (core dumped) wssmrks@MarkusPC:~/42_minishell$