Coder Social home page Coder Social logo

42sh's Introduction

42sh

42sh school project.

By alao, ariard, gwojda, jhalford, wescande.
Final grade : 125/100

More than 10 000 lines of pure C, even the library was written by ourselves. No memory leaks, no crash were allowed. The most impressive project of the first cycle of 42 school cursus.

Mandatory part:

  • Prompt without line edition.
  • Builtins cd, echo, exit, env, setenv, unsetenv with there options.
  • Executing simple commands with there parameters using PATH.
  • Support for redirection >, >>, <and |.
  • Logical operand &&and ||.
  • Separator ;.

Optional feature (five of theses are mandatory to validate the project):

  • Inhibitors ", 'and \.
  • Advanced redirections: aggregation of file output and heredoc <<.
  • Globbing: *, ?, [], {}, etc.
  • Backquotes `.
  • Subshell with operand ().
  • Local variable and builtin unset and export.
  • History with builtin historyand ! with options.
  • Advanced line edition.
  • File descriptors and builtin read with options.
  • Dynamical autocompletion.

Optional feature highly appreciated:

  • Job Control and builtins job, fg, bg and operand &.
  • Shell Scripting in POSIX standards: for, while, until, if/elif/else, {}, bang (!), case, functions, variable assignements

Shell / Subshell

Line editing

Keys Functions
Opt+C
Opt+X
Opt+V
Copy
Cut
Paste
Opt+<
Opt+>
Move per words.
Opt+^
Opt+v
Move per line.
Ctrl+L Clear screen.
Ctrl+C Terminate/Kill current foreground process.
Ctrl+Z Suspend/Stop current foreground process.

History

Keys Functions
^
v
Browse the history.
Ctrl+R Research function.
!! Retype the last command.
!n Retype the n(numerical value) command from the begin of history.
!-n Retype the -n(numerical value) command from the last command.
!name Search for a command beginning with name.
!?name Search for a command which contain name.

Autocompletion

Autocompletion works with binary, path and env variable. Output is colored upon type. Using arrows to navigate is supported. Autorefreshing with a new input from the user: modification of the list of possibility.

Commands Functions
$> l[tab] Search for binary.
$> ls s[tab] Search for path/files.
$> $[tab] Search for variables in env.

Globbing

Pattern Behavior
* Everything.
** Match directory and sub-directory.
? Single char.
[a-z] Match range from a to z.
[!a-z] [^a-z] Exclude range from a to z.
{ab, ac} Match ab or ac.

Hash table

Commands Functions
hash List the content of the hash table.
hash -r Clear the memory of the hash table.

Job Control

Commands Functions
jobs List all the current running jobs.
fg Bring the most recent process to foreground.
fg n Bring the specified jobs to foreground where n is the numerical value of the process found in jobs.

scripting

while compound-list ; do compound-list ; done
until compound-list ; do compound-list ; done
if compound-list ; then compound-list ; elif compound-list ; then compound-list ; else compound-list
for i in list ; do compound-list ; done
case pattern1 in ( pattern2 ) compound-list ;; ( pattern1) compound-list ;; esac
{ compound-list }
! command
func() { compound-list }
VAR="hello world"

42sh's People

Contributors

ariard avatar wescande avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gwojda akinfemi

42sh's Issues

completion

Coucou,
Si je tape ls puis je fais tab, il ne me propose pas ls dans la liste.
Si je tape ema puis je fais tab, il devrai m'auto-remplir avec emacs car tous les résultats commencent par emacs.

backquotes expansion

lors de l'expansion backquotes: pas de fieldsplitting si les backquotes sont dans des doubles quotes (je dois utiliser is_char_esc je crois?)

Exit not work

Lorsqu'on exit le 42/21/minish, il ne rends pas le shell a son etat d'origine (essayez un ctrl+ C apres ...)

Crash interactiv shell

➜ 42sh git:(master) ✗ echo "toto" | ./42sh
[1] 30725 done echo "toto" |
30726 segmentation fault ./42sh

==30690== Memcheck, a memory error detector
==30690== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==30690== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==30690== Command: ./42sh
==30690==
--30690-- run: /usr/bin/dsymutil "./42sh"
--30690-- UNKNOWN fcntl 67!
--30690-- UNKNOWN fcntl 67! (repeated 2 times)
==30690== Invalid read of size 1
==30690== at 0x10001AA72: shell_get_avdata (shell_get_avdata.c:24)
==30690== by 0x10001A94D: main (main.c:95)
==30690== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==30690==
==30690==
==30690== Process terminating with default action of signal 11 (SIGSEGV)
==30690== Access not within mapped region at address 0x0
==30690== at 0x10001AA72: shell_get_avdata (shell_get_avdata.c:24)
==30690== by 0x10001A94D: main (main.c:95)
==30690== If you believe this happened as a result of a stack
==30690== overflow in your program's main thread (unlikely but
==30690== possible), you can try to increase the size of the
==30690== main thread stack using the --main-stacksize= flag.
==30690== The main thread stack size used in this run was 8388608.
==30690==
==30690== HEAP SUMMARY:
==30690== in use at exit: 125,941 bytes in 249 blocks
==30690== total heap usage: 346 allocs, 97 frees, 147,386 bytes allocated
==30690==
==30690== LEAK SUMMARY:
==30690== definitely lost: 0 bytes in 0 blocks
==30690== indirectly lost: 0 bytes in 0 blocks
==30690== possibly lost: 0 bytes in 0 blocks
==30690== still reachable: 103,703 bytes in 60 blocks
==30690== suppressed: 22,238 bytes in 189 blocks
==30690== Reachable blocks (those to which a pointer was found) are not shown.
==30690== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==30690==
==30690== For counts of detected and suppressed errors, rerun with: -v
==30690== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 14 from 14)

crash redir gauche simple

➜ 42sh git:(master) ✗ test < ls
==31346==
==31346== Process terminating with default action of signal 11 (SIGSEGV)
==31346== Access not within mapped region at address 0x104038FF8
==31346== at 0x10001474F: token_append (token_append.c:52)

edition de ligne

Quand je clique ou que je joue avec la molette, ca affiche les caracteres...

globbing ?

➜ 42sh git:(master) ✗ cat f?le
cat: f?le: No such file or directory

J'ai un fichier file dans mon dossier (comportement de zsh) :

➜ 42sh git:(master) ✗ cat ?ile
4
42sh
Makefile
Session.vim
debug
donovan_segaults_06-02
file
file1
file2
file3
includes
libft
objs
out
pdf
script.sh
src
update_makefile.sh

crash ";;;;;;;;;;;;;;"

➜ 42sh git:(master) ✗ valgrind --leak-check=full ./42sh 3>test
==68438== Memcheck, a memory error detector
==68438== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==68438== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==68438== Command: ./42sh
==68438==
--68438-- run: /usr/bin/dsymutil "./42sh"
--68438-- UNKNOWN fcntl 67!
--68438-- UNKNOWN fcntl 67! (repeated 2 times)
➜ 42sh git:(master) ✗ ;;;;;;;;;;;;;;;;;;;;;;;;;
==68438== Invalid write of size 1
==68438== at 0x100001303: print_t2 (btree_print.c:23)
==68438== by 0x100001266: print_t (btree_print.c:59)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== Address 0x10483a4d8 is not stack'd, malloc'd or (recently) free'd
==68438==
==68438==
==68438== Process terminating with default action of signal 11 (SIGSEGV)
==68438== Access not within mapped region at address 0x10483A4D8
==68438== at 0x100001303: print_t2 (btree_print.c:23)
==68438== by 0x100001266: print_t (btree_print.c:59)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== by 0x10000123B: print_t (btree_print.c:56)
==68438== If you believe this happened as a result of a stack
==68438== overflow in your program's main thread (unlikely but
==68438== possible), you can try to increase the size of the
==68438== main thread stack using the --main-stacksize= flag.
==68438== The main thread stack size used in this run was 8388608.
==68438==
==68438== HEAP SUMMARY:
==68438== in use at exit: 141,270 bytes in 851 blocks
==68438== total heap usage: 2,359 allocs, 1,508 frees, 205,203 bytes allocated
==68438==
==68438== 17 bytes in 1 blocks are definitely lost in loss record 11 of 118
==68438== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==68438== by 0x100004244: ft_memalloc (ft_memalloc.c:20)
==68438== by 0x100003921: ft_lstnew (ft_lstnew.c:23)
==68438== by 0x100003370: ft_newfd (get_next_line.c:32)
==68438== by 0x100003229: get_next_line (get_next_line.c:74)
==68438== by 0x10001895B: ft_init_history (readline.c:40)
==68438== by 0x100018AD2: readline_init (readline.c:86)
==68438== by 0x100018B84: readline (readline.c:102)
==68438== by 0x1000194EF: interactive_shell (main.c:56)
==68438== by 0x100019802: main (main.c:92)
==68438==
==68438== 40 bytes in 1 blocks are definitely lost in loss record 45 of 118
==68438== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==68438== by 0x100014873: token_init (token_init.c:19)
==68438== by 0x100013B75: lexer_lex (lexer_lex.c:51)
==68438== by 0x1000195CD: interactive_shell (main.c:62)
==68438== by 0x100019802: main (main.c:92)
==68438==
==68438== 40 bytes in 1 blocks are definitely lost in loss record 46 of 118
==68438== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==68438== by 0x100014873: token_init (token_init.c:19)
==68438== by 0x100013B75: lexer_lex (lexer_lex.c:51)
==68438== by 0x1000141AF: lexer_sep (lexer_sep.c:42)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x100012DEA: lexer_default (lexer_default.c:22)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x1000195CD: interactive_shell (main.c:62)
==68438== by 0x100019802: main (main.c:92)
==68438==
==68438== 40 bytes in 1 blocks are definitely lost in loss record 47 of 118
==68438== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==68438== by 0x100014873: token_init (token_init.c:19)
==68438== by 0x100013B75: lexer_lex (lexer_lex.c:51)
==68438== by 0x1000141AF: lexer_sep (lexer_sep.c:42)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x100012DEA: lexer_default (lexer_default.c:22)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x1000141AF: lexer_sep (lexer_sep.c:42)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x100012DEA: lexer_default (lexer_default.c:22)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x1000195CD: interactive_shell (main.c:62)
==68438==
==68438== 880 bytes in 22 blocks are definitely lost in loss record 102 of 118
==68438== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==68438== by 0x100014873: token_init (token_init.c:19)
==68438== by 0x100013B75: lexer_lex (lexer_lex.c:51)
==68438== by 0x1000141AF: lexer_sep (lexer_sep.c:42)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x100012DEA: lexer_default (lexer_default.c:22)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x1000141AF: lexer_sep (lexer_sep.c:42)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x100012DEA: lexer_default (lexer_default.c:22)
==68438== by 0x100013BB1: lexer_lex (lexer_lex.c:54)
==68438== by 0x1000141AF: lexer_sep (lexer_sep.c:42)
==68438==
==68438== LEAK SUMMARY:
==68438== definitely lost: 1,017 bytes in 26 blocks
==68438== indirectly lost: 0 bytes in 0 blocks
==68438== possibly lost: 0 bytes in 0 blocks
==68438== still reachable: 113,927 bytes in 634 blocks
==68438== suppressed: 26,326 bytes in 191 blocks
==68438== Reachable blocks (those to which a pointer was found) are not shown.
==68438== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==68438==
==68438== For counts of detected and suppressed errors, rerun with: -v
==68438== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 14 from 14)
[1] 68438 segmentation fault valgrind --leak-check=full ./42sh 3> test

job control invalid free

➜ 42sh git:(master) ✗ valgrind --leak-check=full ./42sh 3>test
==7414== Memcheck, a memory error detector
==7414== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7414== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==7414== Command: ./42sh
==7414==
--7414-- UNKNOWN fcntl 67!
--7414-- UNKNOWN fcntl 67! (repeated 2 times)
➜ 42sh git:(master) ✗ vim &
[1] 7423
➜ 42sh git:(master) ✗ fg
fg: no current job
[1] + 7423 suspended vim
➜ 42sh git:(master) ✗ fg
[1] 7423 continued vim
==7414== Syscall param ioctl(generic) points to uninitialised byte(s)
==7414== at 0x100365872: __ioctl (in /usr/lib/system/libsystem_kernel.dylib)
==7414== by 0x100362E26: ioctl (in /usr/lib/system/libsystem_kernel.dylib)
==7414== by 0x100245264: tcsetattr (in /usr/lib/system/libsystem_c.dylib)
==7414== by 0x100011F9B: put_job_in_foreground (put_job_in_foreground.c:25)
==7414== by 0x1000116FD: job_run (job_run.c:20)
==7414== by 0x100010A1C: builtin_fg (builtin_fg.c:34)
==7414== by 0x10000AE56: launch_process (launch_process.c:30)
==7414== by 0x10000A58B: exec_command (exec_command.c:57)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x1000196DD: interactive_shell (main.c:76)
==7414== by 0x1000197C2: main (main.c:93)
==7414== Address 0x100b5e8a8 is 24 bytes inside a block of size 97 alloc'd
==7414== at 0x100038671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7414== by 0x100003EB4: ft_memalloc (in ./42sh)
==7414== by 0x100003591: ft_lstnew (in ./42sh)
==7414== by 0x100010FA0: job_addprocess (job_addprocess.c:27)
==7414== by 0x10000A59D: exec_command (exec_command.c:59)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x10000A390: exec_ampersand (exec_ampersand.c:19)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x1000196DD: interactive_shell (main.c:76)
==7414== by 0x1000197C2: main (main.c:93)
==7414==
==7414== Syscall param ioctl(TIOCGETA) points to unaddressable byte(s)
==7414== at 0x100365872: __ioctl (in /usr/lib/system/libsystem_kernel.dylib)
==7414== by 0x100362E26: ioctl (in /usr/lib/system/libsystem_kernel.dylib)
==7414== by 0x100012025: put_job_in_foreground (put_job_in_foreground.c:34)
==7414== by 0x1000116FD: job_run (job_run.c:20)
==7414== by 0x100010A1C: builtin_fg (builtin_fg.c:34)
==7414== by 0x10000AE56: launch_process (launch_process.c:30)
==7414== by 0x10000A58B: exec_command (exec_command.c:57)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x1000196DD: interactive_shell (main.c:76)
==7414== by 0x1000197C2: main (main.c:93)
==7414== Address 0x100b5e8a8 is 24 bytes inside a block of size 97 free'd
==7414== at 0x100038AB5: free (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7414== by 0x1000111AD: job_free (job_free.c:22)
==7414== by 0x10000344E: ft_lstdelone (in ./42sh)
==7414== by 0x10000321E: ft_lst_delif (in ./42sh)
==7414== by 0x1000116B5: job_remove (job_remove.c:29)
==7414== by 0x100012002: put_job_in_foreground (put_job_in_foreground.c:30)
==7414== by 0x1000116FD: job_run (job_run.c:20)
==7414== by 0x100010A1C: builtin_fg (builtin_fg.c:34)
==7414== by 0x10000AE56: launch_process (launch_process.c:30)
==7414== by 0x10000A58B: exec_command (exec_command.c:57)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x1000196DD: interactive_shell (main.c:76)
==7414== Block was alloc'd at
==7414== at 0x100038671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==7414== by 0x100003EB4: ft_memalloc (in ./42sh)
==7414== by 0x100003591: ft_lstnew (in ./42sh)
==7414== by 0x100010FA0: job_addprocess (job_addprocess.c:27)
==7414== by 0x10000A59D: exec_command (exec_command.c:59)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x10000A390: exec_ampersand (exec_ampersand.c:19)
==7414== by 0x10000AB98: ft_exec (ft_exec.c:39)
==7414== by 0x1000196DD: interactive_shell (main.c:76)
==7414== by 0x1000197C2: main (main.c:93)
==7414==

free manquant historique

Pour ne pas l'oublier quand j'aurai fini de rechercher des bugs ^^

==34044== 8 bytes in 1 blocks are definitely lost in loss record 5 of 112
==34044== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==34044== by 0x100016267: ft_strndup (toolz.c:33)
==34044== by 0x10000FDEA: ft_realloc_str_history_2 (history_parsing_toolz.c:79)
==34044== by 0x10000F9D4: ft_history_parsing_3 (history_parsing.c:54)
==34044== by 0x10000F778: ft_history_parsing (history_parsing.c:86)
==34044== by 0x10000FA95: ft_history_parsing_2 (history_parsing.c:69)
==34044== by 0x10000F7C5: ft_history_parsing (history_parsing.c:93)
==34044== by 0x100018B7A: readline (readline.c:106)
==34044== by 0x1000194BF: interactive_shell (main.c:56)
==34044== by 0x1000197D2: main (main.c:92)
==34044==
==34044== 15 bytes in 2 blocks are definitely lost in loss record 9 of 112
==34044== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==34044== by 0x100016267: ft_strndup (toolz.c:33)
==34044== by 0x10000FDEA: ft_realloc_str_history_2 (history_parsing_toolz.c:79)
==34044== by 0x10000F9D4: ft_history_parsing_3 (history_parsing.c:54)
==34044== by 0x10000F778: ft_history_parsing (history_parsing.c:86)
==34044== by 0x100018B7A: readline (readline.c:106)
==34044== by 0x1000194BF: interactive_shell (main.c:56)
==34044== by 0x1000197D2: main (main.c:92)

dquote bquote quote bquote dquote

gwojda [3:41 PM]
Je suis dans une boucle inf lorsque je fais dquotes bquotes quote bquotes dquotes

[3:42]
Si je ferme la simple quote ca fonctionne par contre

[3:43]
ou si je n'en mets pas

jhalford [3:45 PM]
ce qui se passe dans le cas: il y a un quote a l'intérieur des backquotes donc en gros on va lancer .42sh -c "'"

[3:46]
là le shell n'est pas intéractif, cependant on rencontre une commande non equilibrée mais on peut pas avoir + d'input parceque le shell est non-interactif donc faut lever une erreur de parsing et quitter

lecture sur stdin non intéractive

petit challenge @ariard : voila quelque cas d'execution qui ne marchent pas correctement mais pas tres compliqué a résoudre:

./42sh << "ls"
echo "ls" | ./42sh

probleme:dans ces deux cas l'entree standard n'est pas un terminal (isatty(0) renvoie 0) et donc ce n'est pas un shell "interactif".

  • rajouter une option a data_singleton()->opts SHELL_IS_INTERACTIVE d'après isatty(STDIN)
  • dans le main, si c'est interactif on fait la boucle avec le readline, sinon faut lire sur stdin (tu peux surement reutiliser ta fonction pour lire un fichier mais cette fois tu lis sur 0) puis executer comme un script puis quitter

Attention au cas du genre ./42sh script.sh << "ls -l; echo lol" ou je crois que le shell lis le fichier comme s'il n'y avait pas de stdin (a vérifier)

historique pb multilignes

lorsqu'une commande est multiligne, l'historique enregistre x commandes au lieu d'une seule multi-ligne

completion invalid read

14:20:35 ☀ 42sh_cpy › vim Ma==42439== Invalid read of size 1
==42439== at 0x100005A35: ft_strtrim (ft_strtrim.c:24)
==42439== by 0x100008077: path_solver (c_pathsolver.c:155)
==42439== by 0x1000073BD: c_seek_files (c_files.c:56)
==42439== by 0x1000079CE: c_matching (c_matching.c:27)
==42439== by 0x1000077F7: c_init (c_init.c:65)
==42439== by 0x100008F63: completion (completion.c:113)
==42439== by 0x10001191E: ft_completion (completion.c:26)
==42439== by 0x100011F74: ft_read_stdin (get_touch.c:64)
==42439== by 0x100015CB4: ft_readline (readline.c:84)
==42439== by 0x100017A6F: main (main.c:53)
==42439== Address 0x100b2eaff is 1 bytes before a block of size 1 alloc'd
==42439== at 0x10003B671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==42439== by 0x100004EE6: ft_strdup (ft_strdup.c:21)
==42439== by 0x100005984: ft_strtrim (ft_strtrim.c:20)
==42439== by 0x100008077: path_solver (c_pathsolver.c:155)
==42439== by 0x1000073BD: c_seek_files (c_files.c:56)
==42439== by 0x1000079CE: c_matching (c_matching.c:27)
==42439== by 0x1000077F7: c_init (c_init.c:65)
==42439== by 0x100008F63: completion (completion.c:113)
==42439== by 0x10001191E: ft_completion (completion.c:26)
==42439== by 0x100011F74: ft_read_stdin (get_touch.c:64)
==42439== by 0x100015CB4: ft_readline (readline.c:84)
==42439== by 0x100017A6F: main (main.c:53)
==42439==
==42439== Invalid read of size 1
==42439== at 0x100005A53: ft_strtrim (ft_strtrim.c:24)
==42439== by 0x100008077: path_solver (c_pathsolver.c:155)
==42439== by 0x1000073BD: c_seek_files (c_files.c:56)
==42439== by 0x1000079CE: c_matching (c_matching.c:27)
==42439== by 0x1000077F7: c_init (c_init.c:65)
==42439== by 0x100008F63: completion (completion.c:113)
==42439== by 0x10001191E: ft_completion (completion.c:26)
==42439== by 0x100011F74: ft_read_stdin (get_touch.c:64)
==42439== by 0x100015CB4: ft_readline (readline.c:84)
==42439== by 0x100017A6F: main (main.c:53)
==42439== Address 0x100b2eaff is 1 bytes before a block of size 1 alloc'd
==42439== at 0x10003B671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==42439== by 0x100004EE6: ft_strdup (ft_strdup.c:21)
==42439== by 0x100005984: ft_strtrim (ft_strtrim.c:20)
==42439== by 0x100008077: path_solver (c_pathsolver.c:155)
==42439== by 0x1000073BD: c_seek_files (c_files.c:56)
==42439== by 0x1000079CE: c_matching (c_matching.c:27)
==42439== by 0x1000077F7: c_init (c_init.c:65)
==42439== by 0x100008F63: completion (completion.c:113)
==42439== by 0x10001191E: ft_completion (completion.c:26)
==42439== by 0x100011F74: ft_read_stdin (get_touch.c:64)
==42439== by 0x100015CB4: ft_readline (readline.c:84)
==42439== by 0x100017A6F: main (main.c:53)
==42439==
==42439== Invalid read of size 1
==42439== at 0x100005A6F: ft_strtrim (ft_strtrim.c:24)
==42439== by 0x100008077: path_solver (c_pathsolver.c:155)
==42439== by 0x1000073BD: c_seek_files (c_files.c:56)
==42439== by 0x1000079CE: c_matching (c_matching.c:27)
==42439== by 0x1000077F7: c_init (c_init.c:65)
==42439== by 0x100008F63: completion (completion.c:113)
==42439== by 0x10001191E: ft_completion (completion.c:26)
==42439== by 0x100011F74: ft_read_stdin (get_touch.c:64)
==42439== by 0x100015CB4: ft_readline (readline.c:84)
==42439== by 0x100017A6F: main (main.c:53)
==42439== Address 0x100b2eaff is 1 bytes before a block of size 1 alloc'd
==42439== at 0x10003B671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==42439== by 0x100004EE6: ft_strdup (ft_strdup.c:21)
==42439== by 0x100005984: ft_strtrim (ft_strtrim.c:20)
==42439== by 0x100008077: path_solver (c_pathsolver.c:155)
==42439== by 0x1000073BD: c_seek_files (c_files.c:56)
==42439== by 0x1000079CE: c_matching (c_matching.c:27)
==42439== by 0x1000077F7: c_init (c_init.c:65)
==42439== by 0x100008F63: completion (completion.c:113)
==42439== by 0x10001191E: ft_completion (completion.c:26)
==42439== by 0x100011F74: ft_read_stdin (get_touch.c:64)
==42439== by 0x100015CB4: ft_readline (readline.c:84)
==42439== by 0x100017A6F: main (main.c:53)
==42439==

edition de lignes

ligne très grosse - curseur au debut + entree (j'ai pas accès au mac, mais j'ai oublié de le fixe ce problème il me semble)

retour erreur

➜ 42sh git:(master) ✗ echo $?
$?

-->lié au module de glob qui prend le '?' en compte ???
(je precise que j'avais exec une commande avant, et donc ? etait bien set dans l'env)

invalid free double redir droite

➜ 42sh git:(master) ✗ ls >> test
==31798== Invalid read of size 8
==31798== at 0x100019FDC: parse_dgreat (parse_dgreat.c:32)
==31798== by 0x10001A725: parse_redir (parse_redir.c:27)
==31798== by 0x100019EB8: ft_parse (ft_parse.c:44)
==31798== by 0x1000196B0: interactive_shell (main.c:72)
==31798== by 0x1000197D2: main (main.c:92)
==31798== Address 0x100b4d970 is 16 bytes inside a block of size 24 free'd
==31798== at 0x10003FAB5: free (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==31798== by 0x10000352D: ft_lstdelone (ft_lstdelone.c:21)
==31798== by 0x1000032EE: ft_lst_delif (ft_lst_delif.c:31)
==31798== by 0x100019FC2: parse_dgreat (parse_dgreat.c:31)
==31798== by 0x10001A725: parse_redir (parse_redir.c:27)
==31798== by 0x100019EB8: ft_parse (ft_parse.c:44)
==31798== by 0x1000196B0: interactive_shell (main.c:72)
==31798== by 0x1000197D2: main (main.c:92)
==31798== Block was alloc'd at
==31798== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==31798== by 0x10000361E: ft_lstnew (ft_lstnew.c:19)
==31798== by 0x100013B5C: lexer_lex (lexer_lex.c:52)
==31798== by 0x100012ED0: lexer_delim (lexer_delim.c:25)
==31798== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==31798== by 0x1000141E4: lexer_word (lexer_word.c:25)
==31798== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==31798== by 0x100014250: lexer_word (lexer_word.c:34)
==31798== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==31798== by 0x100014250: lexer_word (lexer_word.c:34)
==31798== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==31798== by 0x100012E36: lexer_default (lexer_default.c:28)
==31798==

completion

problème quand trop de fichier a compléter.
ex "/dev/" puis tab

pas de completion sur un chemin avec path complexe
ex "/dev/u" puis tab qui doit renvoyer "/dev/urandom"

crash redir droite

spam des redir a droite = crash

==30761== Memcheck, a memory error detector
==30761== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==30761== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==30761== Command: ./42sh
==30761==
--30761-- UNKNOWN fcntl 67!
--30761-- UNKNOWN fcntl 67! (repeated 2 times)
➜ 42sh git:(master) ✗ >>>>>>>>>>>>>>>>>>>>>>>
==30761==
==30761== Process terminating with default action of signal 11 (SIGSEGV)
==30761== Access not within mapped region at address 0x104038FF8
==30761== at 0x100014502: token_append_char (token_append.c:18)
==30761== If you believe this happened as a result of a stack
==30761== overflow in your program's main thread (unlikely but
==30761== possible), you can try to increase the size of the
==30761== main thread stack using the --main-stacksize= flag.
==30761== The main thread stack size used in this run was 8388608.
==30761==
==30761== HEAP SUMMARY:
==30761== in use at exit: 4,303,799 bytes in 210,917 blocks
==30761== total heap usage: 211,819 allocs, 902 frees, 4,341,906 bytes allocated

invalid read glob

➜ 42sh git:(master) ✗ ls **
==31998== Invalid read of size 1
==31998== at 0x10000EC43: match_star (match_pattern.c:76)
==31998== by 0x10000E8A0: match_pattern (match_pattern.c:117)
==31998== by 0x10000BCD9: dir_list_content (dir_glob.c:37)
==31998== by 0x10000BBBA: dir_research (dir_glob.c:59)
==31998== by 0x10000D98A: glob (glob.c:54)
==31998== by 0x10000A6B2: token_to_argv (exec_command.c:30)
==31998== by 0x10000A598: exec_command (exec_command.c:55)
==31998== by 0x10000ABF8: ft_exec (ft_exec.c:39)
==31998== by 0x1000196E3: interactive_shell (main.c:75)
==31998== by 0x1000197D2: main (main.c:92)
==31998== Address 0x100b76633 is 0 bytes after a block of size 3 alloc'd
==31998== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==31998== by 0x100004FC6: ft_strdup (ft_strdup.c:21)
==31998== by 0x10000D869: glob (glob.c:43)
==31998== by 0x10000A6B2: token_to_argv (exec_command.c:30)
==31998== by 0x10000A598: exec_command (exec_command.c:55)
==31998== by 0x10000ABF8: ft_exec (ft_exec.c:39)
==31998== by 0x1000196E3: interactive_shell (main.c:75)
==31998== by 0x1000197D2: main (main.c:92)
==31998==

completion

Il y a des choses qui ne marchent pas exactement comme zsh, ici je vais citer seulement ce qui n'est pas acceptable:

  • /ho[tab] me propose tous les fichiers dans / alors qu'il n'y a que /home qui correspond (ici zsh complete affiche /home/ : à noter qu'il ajoute le / final pour pouvoir continuer de tabber directement) (le probleme à l'air d'etre lié a la complémetion "document" lorsque c'est en début de commande: ./src/[tab] sort la liste des ./ ) !

  • ls < [tab] ne me propose pas de completion (a noter que j'ai bien mis un espace apres le <, j'imagine que le [tab] collé au < doit poser un probleme de reconaissance de symboles du shell donc si tu ne veux pas l'implementer je comprends...)

J'ai trouvé d'autres erreurs mais je les soupçonne d'être des dérivées de celle deja citées.

Bon courage!

crash redir gauche

crash en cas de nombre impair > 2 de redir a gauche
==30637== Invalid write of size 8
==30637== at 0x1000138C0: lexer_less (lexer_less.c:33)
==30637== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==30637== by 0x100012DE8: lexer_default (lexer_default.c:24)
==30637== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==30637== by 0x10001959D: interactive_shell (main.c:62)
==30637== by 0x1000197D2: main (main.c:92)
==30637== Address 0x100b4d340 is 0 bytes inside a block of size 41 free'd
==30637== at 0x10003FAB5: free (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==30637== by 0x100014823: token_free (token_free.c:24)
==30637== by 0x1000138A5: lexer_less (lexer_less.c:31)
==30637== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==30637== by 0x100012DE8: lexer_default (lexer_default.c:24)
==30637== by 0x100013B81: lexer_lex (lexer_lex.c:54)
==30637== by 0x10001959D: interactive_shell (main.c:62)
==30637== by 0x1000197D2: main (main.c:92)
==30637== Block was alloc'd at
==30637== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==30637== by 0x100003F84: ft_memalloc (ft_memalloc.c:20)
==30637== by 0x100003661: ft_lstnew (ft_lstnew.c:23)
==30637== by 0x100013B5C: lexer_lex (lexer_lex.c:52)
==30637== by 0x10001959D: interactive_shell (main.c:62)
==30637== by 0x1000197D2: main (main.c:92)
==30637==

Pb lorsque binaire pas executable

En lancant la commande /dev, j'ai une erreur d'execution, mais le fork a eu lieu et le shell se trouve dédoublé.
Ex ci dessous, je suis obligé de faire 2 exit pour quitter


>  e3r8p16  ~/Documents/PersonalFile/42sh   pda  ./42sh 3>/dev/null


➜  42sh git:(pda) ✓ /dev
minishell: internal execve error on /dev
➜  42sh git:(pda) ✓ exit
➜  42sh git:(pda) ✓ exit

retour d'erreur

taper un nom de path valide ne renvoi pas d'erreur dans le terminal (on a bien l'erreur dans le prompt)

Redirection gauche et droite simple

14:42:52 42sh_cpy › wc -l < Makefile

14:42:59 42sh_cpy › Makefile > wc -l
minishell: command not found: Makefile

14:45:42 42sh_cpy › ls
42sh Makefile libft out script.sh update_makefile.sh
42sh.dSYM includes objs pdf src

matching

pb matching range [a-z] + star ?

Fonctions interdites

Hola,
Nous utilisons des fonctions interdites. au 31/01/2017 j'ai recensé celles-ci:
atexit
perror
printf
sleep
time, localtime, setlocale (bonus ?)

crash spam pipe

➜ 42sh git:(master) ✗ |||||||||||||||||
==30968== Invalid read of size 1
==30968== at 0x10000A824: exec_or_if (exec_or_if.c:30)
==30968== by 0x10000ABF8: ft_exec (ft_exec.c:39)
==30968== by 0x1000196E3: interactive_shell (main.c:75)
==30968== by 0x1000197D2: main (main.c:92)
==30968== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==30968==
==30968==
==30968== Process terminating with default action of signal 11 (SIGSEGV)
==30968== Access not within mapped region at address 0x0
==30968== at 0x10000A824: exec_or_if (exec_or_if.c:30)
==30968== by 0x10000ABF8: ft_exec (ft_exec.c:39)
==30968== by 0x1000196E3: interactive_shell (main.c:75)
==30968== by 0x1000197D2: main (main.c:92)
==30968== If you believe this happened as a result of a stack
==30968== overflow in your program's main thread (unlikely but
==30968== possible), you can try to increase the size of the
==30968== main thread stack using the --main-stacksize= flag.
==30968== The main thread stack size used in this run was 8388608.
==30968==
==30968== HEAP SUMMARY:
==30968== in use at exit: 146,510 bytes in 1,282 blocks
==30968== total heap usage: 2,617 allocs, 1,335 frees, 203,795 bytes allocated

Job control - processus zombie

➜ 42sh git:(master) ✗ exit
minishell: you have live jobs (running or suspended).

➜ 42sh git:(master) ✗ exit
➜ 42sh git:(master) ✗ ps
PID TTY TIME CMD
75042 ttys000 0:00.02 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server login -fp gwojda
75056 ttys000 0:00.71 -zsh
8672 ttys002 0:00.02 vim
88449 ttys002 0:00.03 /Applications/iTerm.app/Contents/MacOS/iTerm2 --server login -fp gwojda
88461 ttys002 0:00.46 -zsh

reset des termcap

le shell ne restitue pas les termcap (ex ctrl + c apres avoir quitter le shell)

erreur globbing - accolade

➜ 42sh git:(master) ✗ echo t{a,o}to
==50329== Conditional jump or move depends on uninitialised value(s)
==50329== at 0x1000050D8: ft_strlen (ft_strlen.c:22)
==50329== by 0x100005025: ft_strjoin (ft_strjoin.c:19)
==50329== by 0x10000C45B: iter_on_each (expand_brace.c:56)
==50329== by 0x10000C3AC: init_expand (expand_brace.c:80)
==50329== by 0x10000C204: search_brace (expand_brace.c:106)
==50329== by 0x10000BF3F: expand_brace (expand_brace.c:135)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329==
==50329== Conditional jump or move depends on uninitialised value(s)
==50329== at 0x100004BD0: ft_strcat (ft_strcat.c:22)
==50329== by 0x100005087: ft_strjoin (ft_strjoin.c:24)
==50329== by 0x10000C45B: iter_on_each (expand_brace.c:56)
==50329== by 0x10000C3AC: init_expand (expand_brace.c:80)
==50329== by 0x10000C204: search_brace (expand_brace.c:106)
==50329== by 0x10000BF3F: expand_brace (expand_brace.c:135)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329==
==50329== Conditional jump or move depends on uninitialised value(s)
==50329== at 0x1000050D8: ft_strlen (ft_strlen.c:22)
==50329== by 0x10000C4B1: iter_on_each (expand_brace.c:59)
==50329== by 0x10000C3AC: init_expand (expand_brace.c:80)
==50329== by 0x10000C204: search_brace (expand_brace.c:106)
==50329== by 0x10000BF3F: expand_brace (expand_brace.c:135)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329==
==50329== Conditional jump or move depends on uninitialised value(s)
==50329== at 0x1000050D8: ft_strlen (ft_strlen.c:22)
==50329== by 0x10000C564: iter_on_each (expand_brace.c:62)
==50329== by 0x10000C3AC: init_expand (expand_brace.c:80)
==50329== by 0x10000C204: search_brace (expand_brace.c:106)
==50329== by 0x10000BF3F: expand_brace (expand_brace.c:135)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329==
==50329== Invalid read of size 8
==50329== at 0x10000BF67: expand_brace (expand_brace.c:137)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329== Address 0x100b87908 is 8 bytes inside a block of size 24 free'd
==50329== at 0x10003FAB5: free (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==50329== by 0x10000DEBD: ft_ld_del (ft_ld_del.c:26)
==50329== by 0x10000BF5E: expand_brace (expand_brace.c:136)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329== Block was alloc'd at
==50329== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==50329== by 0x10000E1E6: ft_ld_pushfront (ft_ld_pushfront.c:22)
==50329== by 0x10000BE42: expand_brace (expand_brace.c:123)
==50329== by 0x10000D8C7: glob (glob.c:47)
==50329== by 0x10000A672: token_to_argv (exec_command.c:30)
==50329== by 0x10000A558: exec_command (exec_command.c:55)
==50329== by 0x10000ABB8: ft_exec (ft_exec.c:39)
==50329== by 0x1000196D3: interactive_shell (main.c:75)
==50329== by 0x1000197C2: main (main.c:92)
==50329==
tato toto

parenthésage intéractif

en plus des quotes backslash et backquotes bash vérifie l'équilibrage de:

  • backquotes
  • parenthèses de subshell
  • acollades du globbing

je sais pas si ca vaut le coup que tu le fasse, si c'est trop compliqué ya moyen d'adapter le lexer pour que tu puisse lui demander directement si c'est équilibré ou pas.

'lssssssss'

Je vous laisse lancer cette commande la... ^^ (sans les simples quotes)
screen shot 2017-02-19 at 11 59 45 am

crash echo + pipe

➜ 42sh_test_completion git:(master) ✗ echo "test" | grep "test"
==74809== Invalid read of size 8
==74809== at 0x100010FF4: job_addprocess (job_addprocess.c:29)
==74809== by 0x10000A94D: exec_command (exec_command.c:59)
==74809== by 0x10000AF78: ft_exec (ft_exec.c:39)
==74809== by 0x10000AD2E: exec_pipe (exec_pipe.c:40)
==74809== by 0x10000AF78: ft_exec (ft_exec.c:39)
==74809== by 0x100019713: interactive_shell (main.c:75)
==74809== by 0x100019802: main (main.c:92)
==74809== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==74809==
==74809==
==74809== Process terminating with default action of signal 11 (SIGSEGV)
==74809== Access not within mapped region at address 0x0
==74809== at 0x100010FF4: job_addprocess (job_addprocess.c:29)
==74809== by 0x10000A94D: exec_command (exec_command.c:59)
==74809== by 0x10000AF78: ft_exec (ft_exec.c:39)
==74809== by 0x10000AD2E: exec_pipe (exec_pipe.c:40)
==74809== by 0x10000AF78: ft_exec (ft_exec.c:39)
==74809== by 0x100019713: interactive_shell (main.c:75)
==74809== by 0x100019802: main (main.c:92)
==74809== If you believe this happened as a result of a stack
==74809== overflow in your program's main thread (unlikely but
==74809== possible), you can try to increase the size of the
==74809== main thread stack using the --main-stacksize= flag.
==74809== The main thread stack size used in this run was 8388608.
==74809==
==74809== HEAP SUMMARY:
==74809== in use at exit: 139,383 bytes in 821 blocks
==74809== total heap usage: 1,943 allocs, 1,122 frees, 212,695 bytes allocated
==74809==
==74809== 34 (24 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 57 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100004494: ft_memalloc (ft_memalloc.c:20)
==74809== by 0x100004A88: ft_sstradd (ft_sstradd.c:26)
==74809== by 0x10000AA77: token_to_argv (exec_command.c:34)
==74809== by 0x10000A918: exec_command (exec_command.c:55)
==74809== by 0x10000AF78: ft_exec (ft_exec.c:39)
==74809== by 0x10000ACCD: exec_pipe (exec_pipe.c:31)
==74809== by 0x10000AF78: ft_exec (ft_exec.c:39)
==74809== by 0x100019713: interactive_shell (main.c:75)
==74809== by 0x100019802: main (main.c:92)
==74809==
==74809== 40 bytes in 1 blocks are definitely lost in loss record 58 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100014883: token_init (token_init.c:19)
==74809== by 0x100013B85: lexer_lex (lexer_lex.c:51)
==74809== by 0x1000195CD: interactive_shell (main.c:62)
==74809== by 0x100019802: main (main.c:92)
==74809==
==74809== 40 bytes in 1 blocks are definitely lost in loss record 59 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100014883: token_init (token_init.c:19)
==74809== by 0x100013B85: lexer_lex (lexer_lex.c:51)
==74809== by 0x100012F10: lexer_delim (lexer_delim.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014224: lexer_word (lexer_word.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x1000132BE: lexer_dquote (lexer_dquote.c:31)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x1000133C4: lexer_dquote (lexer_dquote.c:50)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x1000133C4: lexer_dquote (lexer_dquote.c:50)
==74809==
==74809== 40 bytes in 1 blocks are definitely lost in loss record 60 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100014883: token_init (token_init.c:19)
==74809== by 0x100013B85: lexer_lex (lexer_lex.c:51)
==74809== by 0x1000141BF: lexer_sep (lexer_sep.c:42)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100012DFA: lexer_default (lexer_default.c:22)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100012F10: lexer_delim (lexer_delim.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014224: lexer_word (lexer_word.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x1000132BE: lexer_dquote (lexer_dquote.c:31)
==74809==
==74809== 41 bytes in 1 blocks are definitely lost in loss record 63 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100004494: ft_memalloc (ft_memalloc.c:20)
==74809== by 0x1000010D4: btree_create_node (btree_create_node.c:31)
==74809== by 0x100019E51: ft_parse (ft_parse.c:38)
==74809== by 0x10001A856: parse_separator (parse_separator.c:25)
==74809== by 0x100019EE8: ft_parse (ft_parse.c:44)
==74809== by 0x1000196E0: interactive_shell (main.c:72)
==74809== by 0x100019802: main (main.c:92)
==74809==
==74809== 58 (48 direct, 10 indirect) bytes in 2 blocks are definitely lost in loss record 72 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100003B2E: ft_lstnew (ft_lstnew.c:19)
==74809== by 0x100003D3C: push (push.c:17)
==74809== by 0x100013279: lexer_dquote (lexer_dquote.c:26)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100012DFA: lexer_default (lexer_default.c:22)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100012F10: lexer_delim (lexer_delim.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014224: lexer_word (lexer_word.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014290: lexer_word (lexer_word.c:34)
==74809==
==74809== 80 bytes in 2 blocks are definitely lost in loss record 84 of 129
==74809== at 0x10003F671: malloc (in /Users/gwojda/.brew/Cellar/valgrind/3.12.0/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
==74809== by 0x100014883: token_init (token_init.c:19)
==74809== by 0x100013B85: lexer_lex (lexer_lex.c:51)
==74809== by 0x100012F10: lexer_delim (lexer_delim.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014224: lexer_word (lexer_word.c:25)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014290: lexer_word (lexer_word.c:34)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014290: lexer_word (lexer_word.c:34)
==74809== by 0x100013BC1: lexer_lex (lexer_lex.c:54)
==74809== by 0x100014290: lexer_word (lexer_word.c:34)
==74809==
==74809== LEAK SUMMARY:
==74809== definitely lost: 313 bytes in 9 blocks
==74809== indirectly lost: 20 bytes in 4 blocks
==74809== possibly lost: 0 bytes in 0 blocks
==74809== still reachable: 112,724 bytes in 617 blocks
==74809== suppressed: 26,326 bytes in 191 blocks
==74809== Reachable blocks (those to which a pointer was found) are not shown.
==74809== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==74809==
==74809== For counts of detected and suppressed errors, rerun with: -v
==74809== ERROR SUMMARY: 8 errors from 8 contexts (suppressed: 14 from 14)
[1] 74809 segmentation fault valgrind --leak-check=full ./42sh 3> test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.