LukasKava / Minishell

0 stars 0 forks source link

crash log in cd #70

Open Gotr-byte opened 1 year ago

Gotr-byte commented 1 year ago

piotr@piotr-Lenovo-G50-80:~/code/minivv7$ ./minishell BiebianOS> cd ../. ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [../.]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr/code BiebianOS> cd ../. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [../.]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr BiebianOS> echo .././././. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [.././././.]

.././././. BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr BiebianOS> echo .././././. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [.././././.]

.././././. BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr BiebianOS> cd .././././. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [.././././.]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

piotr BiebianOS> cd piotr/ ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [piotr/]

BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

111.txt code Documents fi inf newfile.txt Public teams_1.3.00.5153amd64.deb Videos ambassadorship.txt Desktop Downloads fi.txt Music Pictures snap Templates BiebianOS> cd code ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [code]

BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

archive minivv7 BiebianOS> mkdir srcs ____CHUNK LIST____ full listC: indentifier: 20: /usr/bin/mkdir ARGUMENTS: [mkdir] [srcs]

BiebianOS> cd srcs/ ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [srcs/]

BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> cd srcs objs ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [srcs] [objs]

To many arguments! BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

archive minivv7 srcs BiebianOS> cd 'srcs' ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [srcs]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr/code/srcs BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr/code/srcs BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> cd "srcs" ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [srcs]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr/code/srcs BiebianOS> cd "srcs" ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [srcs]

chdir a: : No such file or directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd /etc ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/etc]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/etc BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> cd /e'tc' ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/etc]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/etc BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

bin cdrom etc lib lib64 lost+found mnt proc run snap swapfile tmp var boot dev home lib32 libx32 media opt root sbin srv sys usr BiebianOS> cd home ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [home]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home BiebianOS> cd /e"tc" ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/etc]

BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/etc BiebianOS> cd sr ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [sr]

chdir a: : No such file or directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/etc BiebianOS> cd $OLDPWD ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/home]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home BiebianOS> cd piotr/ ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [piotr/]

BiebianOS> cd cod ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [cod]

chdir a: : No such file or directory BiebianOS> cd code ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [code]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr/code BiebianOS> mkdir sr ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/mkdir ARGUMENTS: [mkdir] [sr]

BiebianOS> cd sr ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [sr]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/home/piotr/code/sr BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> cd minivv7/ ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [mini_vv7/]

BiebianOS> cd makefile ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [makefile]

chdir a: : Not a directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd sr ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [sr]

chdir a: : No such file or directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd ../minishell ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [../minishell]

chdir a: : No such file or directory BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

includes libft makefile minishell minishell.dSYM nonPerm.txt norm.txt README.md src BiebianOS> cd ../../../../../../../../.. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [../../../../../../../../..]

BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> cd ../minishell ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [../minishell]

chdir a: : No such file or directory BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

bin cdrom etc lib lib64 lost+found mnt proc run snap swapfile tmp var boot dev home lib32 libx32 media opt root sbin srv sys usr BiebianOS> cd home/piotr/ .azure/ .npm/ Pictures/ .bash_history .nuget/ Public/ .bash_logout .pki/ Templates/ .bashrc .profile Videos/ .bashrc.bak .ssh/ ambassadorship.txt .cache/ .sudo_as_admin_successful code/ .config/ .vscode/ fi .dotnet/ .wget-hsts fi.txt .gitconfig 111.txt inf .gnupg/ Desktop/ newfile.txt .lesshst Documents/ snap/ .local/ Downloads/ teams_1.3.00.5153_amd64.deb .net/ Music/
BiebianOS> cd home/piotr/code/ .vscode/ archive/ mini_vv7/ sr/ srcs/
BiebianOS> cd home/piotr/code/minivv7/minishell ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [home/piotr/code/mini_vv7/minishell]

chdir a: : Not a directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd .././../.././../bin/ls ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [.././../.././../bin/ls]

chdir a: : Not a directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd / ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/]

BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> cd '/' ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/]

BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> cd // ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [//]

BiebianOS> cd '//' ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [//]

BiebianOS> cd /// ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [///]

BiebianOS> cd //////// ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [////////]

BiebianOS> cd '///////' ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [///////]

BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [0]

0 BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> cd ////// ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [//////]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> cd home ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [home]

BiebianOS> cd ///// ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/////]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> cd home ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [home]

BiebianOS> cd '///////' ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [///////]

BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> cd // ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [//]

BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

bin cdrom etc lib lib64 lost+found mnt proc run snap swapfile tmp var boot dev home lib32 libx32 media opt root sbin srv sys usr BiebianOS> cd /minivv7 ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/mini_vv7]

chdir a: : No such file or directory BiebianOS> cd ~/minivv7 ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [~/mini_vv7]

chdir a: : No such file or directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd / ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [/]

BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

bin home lost+found root swapfile boot lib media run sys cdrom lib32 mnt sbin tmp dev lib64 opt snap usr etc libx32 proc srv var BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> cd .. ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [..]

BiebianOS> cd. ____CHUNK LIST_____ full listC: indentifier: 20: (null) ARGUMENTS: [cd.]

cd.: Write propper commands, eat healthy. BiebianOS> cd ____CHUNK LIST____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [_]

chdir a: : No such file or directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> cd - ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [-]

BiebianOS> BiebianOS> pwd ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [pwd]

/ BiebianOS> cd home/ ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [home/]

BiebianOS> cd - ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [-]

BiebianOS> ls ____CHUNK LIST_____ full listC: indentifier: 20: /usr/bin/ls ARGUMENTS: [ls]

bin home lost+found root swapfile boot lib media run sys cdrom lib32 mnt sbin tmp dev lib64 opt snap usr etc libx32 proc srv var BiebianOS> cd home ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [home]

BiebianOS> cd -- ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [cd] [--]

chdir a: : No such file or directory BiebianOS> echo $? ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [echo] [10]

10 BiebianOS> exit ____CHUNK LIST_____ full listC: indentifier: 21: (null) ARGUMENTS: [exit]

exit

================================================================= ==89385==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:

0 0x7f00163b3867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x7f00162e4bac in xmalloc (/lib/x86_64-linux-gnu/libreadline.so.8+0x39bac)

Direct leak of 10 byte(s) in 1 object(s) allocated from:

0 0x7f00163b3867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x55a3291cb5bd in ft_calloc (/home/piotr/code/mini_vv7/minishell+0x1c5bd)
#2 0x55a3291be08f in ft_strtrim_f src/parsing/expansions_utils.c:29
#3 0x55a3291c2f1a in all_cases src/builtins/cd2.c:60
#4 0x55a3291c25a7 in cd_possible src/builtins/cd.c:71
#5 0x55a3291c2834 in builtins_cd src/builtins/cd.c:111
#6 0x55a3291c9d5c in cd_handle src/execute/builtin_handles.c:38
#7 0x55a3291c7394 in no_fork_handle src/execute/new_fork.c:35
#8 0x55a3291c7938 in built_in_handler src/execute/new_fork.c:74
#9 0x55a3291caf2b in pipe_fork src/execute/execution.c:62
#10 0x55a3291c7b89 in execute src/execute/new_fork.c:90
#11 0x55a3291b3cee in parsing_and_execution src/parsing/main.c:94
#12 0x55a3291b4004 in main src/parsing/main.c:121
#13 0x7f00160acd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 238 byte(s) in 14 object(s) allocated from:

0 0x7f00163b3867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x7f00162e4bac in xmalloc (/lib/x86_64-linux-gnu/libreadline.so.8+0x39bac)

SUMMARY: AddressSanitizer: 280 byte(s) leaked in 16 allocation(s).

Gotr-byte commented 1 year ago

It seems to be a double free. I commented out line 77: // free(s_case); Seems to be working now and not crashing but I need confirmation that we remove this.