minishell's Issues
Linux (Debian) sigaction return `EINVAL`.
Linux (Debian) sigaction return EINVAL
.
Lines 39 to 101 in 4a9cf26
Note
ERRORS
EFAULT act or oldact points to memory which is not a valid part
of the process address space.
EINVAL An invalid signal was specified. This will also be
generated if an attempt is made to change the action for
SIGKILL or SIGSTOP, which cannot be caught or ignored.
GNU implementation of sigaction
:
/* Change and/or query the action that will be taken on delivery of
signal SIG. If not NULL, ACT describes the new behavior. If not
NULL, OACT is set to the prior behavior. Return 0 on success, or
set errno and return -1 on failure. */
int
sigaction (int sig, const struct sigaction *restrict act,
struct sigaction *restrict oact)
{
sigset_t mask;
sigset_t oldmask;
int saved_errno;
if (sig < 0 || NSIG <= sig || sig == SIGKILL || sig == SIGSTOP
|| (act && act->sa_handler == SIG_ERR))
{
errno = EINVAL;
return -1;
}
if (act)
{
/* Safe to install the handler before updating action_array,
since all signals are currently blocked. */
if (act->sa_handler == SIG_DFL || act->sa_handler == SIG_IGN)
{
if (signal (sig, act->sa_handler) == SIG_ERR)
goto failure;
action_array[sig].sa_handler = NULL;
}
else
{
if (signal (sig, sigaction_handler) == SIG_ERR)
goto failure;
action_array[sig] = *act;
}
}
sigprocmask (SIG_SETMASK, &oldmask, NULL);
return 0;
failure:
saved_errno = errno;
sigprocmask (SIG_SETMASK, &oldmask, NULL);
errno = saved_errno;
return -1;
Cleaner need to split args between `|<>`
Actual behavior :
(o_O)> 1|2|3|4|%
1|2|3|4|%.......................................................
CMD [0]=> [WIP/bin/1|2|3|4|%]
[
{
type: 0,
content_len: 1,
arg: [
[0]: "WIP/bin/1|2|3|4|%",
],
},
]
(o_O)>
Expected behavior :
(o_O)> 1|2|3|4|%
1.|.2.|.3.|.4.|.%...............................................
CMD [0]=> [WIP/bin/1]
PIPE [1]=> [|]
CMD [2]=> [WIP/bin/2]
PIPE [3]=> [|]
CMD [4]=> [WIP/bin/3]
PIPE [5]=> [|]
CMD [6]=> [WIP/bin/4]
PIPE [7]=> [|]
CMD [8]=> [WIP/bin/%]
[
{
type: 0,
content_len: 9,
arg: [
[0]: "WIP/bin/1",
[1]: "|",
[2]: "WIP/bin/2",
[3]: "|",
[4]: "WIP/bin/3",
[5]: "|",
[6]: "WIP/bin/4",
[7]: "|",
[8]: "WIP/bin/%",
],
},
]
(o_O)>
minishell/src/1_line_cleaner/line_cleaner.c
Lines 22 to 62 in 2dc0a47
readline return when sigaction call a funtion
readline return if we do two different signal one after another when using sigaction.
UwU $> ^C
UwU $> ^\
[LOG] readline read
null line_read
bash-3.2$
UwU $> ^\^\^\^\^\^\^\^\^C
[LOG] sigaction call
UwU $>
[LOG] readline read
null line_read
bash-3.2$
Note
readline()
is not in the signal-safety list
It's wok with signal()
but this function is deprecated.
We need to reset the signal each call.
Lines 52 to 74 in b37c42b
Makefile lib manager case-sensitive
Find a way to check if makefile
, Makefile
or MakeFile
if [ -f $$path/makefile ];
Valgrind "mem leak"
Todo
Try valgrind on Linux (macos broken)
==61471==
==61471== HEAP SUMMARY:
==61471== in use at exit: 299,207 bytes in 389 blocks
==61471== total heap usage: 627 allocs, 238 frees, 322,372 bytes allocated
==61471==
==61471== LEAK SUMMARY:
==61471== definitely lost: 30,510 bytes in 19 blocks
==61471== indirectly lost: 134,095 bytes in 190 blocks
==61471== possibly lost: 2,032 bytes in 1 blocks
==61471== still reachable: 118,695 bytes in 18 blocks
==61471== suppressed: 13,875 bytes in 161 blocks
==61471== Rerun with --leak-check=full to see details of leaked memory
==61471==
==61471== Use --track-origins=yes to see where uninitialised values come from
==61471== For lists of detected and suppressed errors, rerun with: -s
==61471== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 1 from 1)
Makefile continue de compiler quand une dépendance return une error.
➜ fluffy git:(V3) ✗ make SANI=1 exe
/!\ Debug ➜ vector_lib.a : src/vec_resize.c: In function ‘vec_resize_strict’:
src/vec_resize.c:26:42: error: expected ‘;’ before ‘if’
printf("########\n#RESIZE#\n########\n")
^
;
src/vec_resize.c:28:2:
if (!vec)
~~
make[1]: *** [Makefile:129: vector_lib.a_obj/vec_resize.o] Error 1
/!\ Debug ➜ libft.a :
/!\ Debug ➜ minishell_exe :
Line cleaner var substitution deleting one char after it
(o_O)> abc def | xd $PWD hij
[abc def | xd $PWD hij]
Word
[ ]
Word
[ ]
[ |]
[ ]
Word
[ ]
[ $]
[ ]
Word
abc.def.|.xd./Users/fluffy/Code/minishell/willahij..............
abc.def.|.xd./Users/fluffy/Code/minishell/willahij..............
[
content_len: 3,
{
type: 1,
arg: [
[0]: "abc",
[1]: "def",
]
{
type: 2,
arg: [
[0]: "|",
]
{
type: 1,
arg: [
[0]: "xd",
[1]: "/Users/fluffy/Code/minishell/willahij",
]
]
Handle empty ENV
Case to test
bash-3.2$ ./a.out $A $A echo UwU
[1]: ->[echo]<-
[2]: ->[UwU]<-
bash-3.2$ ./a.out "$A" "$A" echo UwU
[1]: ->[]<-
[2]: ->[]<-
[3]: ->[echo]<-
[4]: ->[UwU]<-
bash-3.2$ ./a.out '$A' '$A' echo UwU
[1]: ->[$A]<-
[2]: ->[$A]<-
[3]: ->[echo]<-
[4]: ->[UwU]<-
Need to move the libft to the team repo
Special case for cleaner
TODO FIX
Actual behavior
(o_O)> echo \$PWD
Word
[ ]
[\]
[$]
echo./Users/mahadad/goinfre/minishell...........................
Expected
(o_O)> echo \$PWD
Word
[ ]
[\]
[$]
echo.$PWD.......................................................
Rework line lexer
- function array for all pipe case
< > << >> |
minishell/src/2_line_lexer/line_lexer.c
Lines 61 to 104 in 0fec9d5
Malloc check
Todo
Check the return from vec_add
vec_fill
and ...
If one return NULL -> exit failure Malloc fail
Makefile `DEBUG=2`
Todo
fix the DEBUG=2
flag
Behavior
➜ minishell git:(master) ✗ make DEBUG=2 exe
libft.a :
/!\ DEBUG ENABLE /!\
Flag used:
-Wall
-Wextra
-Werror
vector_lib.a :
/!\ DEBUG ENABLE /!\
Flag used:
-Wall
-Wextra
-Werror
minishell_exe :
/!\ DEBUG ENABLE /!\
Flag used:
-Wall
-Wextra
-Werror
Expected
Add -g3
to the flags compilation.
➜ minishell git:(master) ✗ make DEBUG=2 exe
libft.a :
/!\ DEBUG ENABLE /!\
Flag used:
-Wall
-Wextra
-Werror
-g3
vector_lib.a :
/!\ DEBUG ENABLE /!\
Flag used:
-Wall
-Wextra
-Werror
-g3
minishell_exe :
/!\ DEBUG ENABLE /!\
Flag used:
-Wall
-Wextra
-Werror
-g3
errno 14: Bad address => "$PWD/_src/arg_test_linux 1 2 3
Error Bad address when having 3 arg ina executable ?
Possible Leaks in $? implementation
=================================================================
==28351==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 2 byte(s) in 1 object(s) allocated from:
#0 0x7f8dbc12e330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
#1 0x5576b5978588 in ft_itoa src/atoi/ft_itoa.c:67
#2 0x5576b5970cab in add_varsub src/1_parser/parser_param_func/lexer_var_sub.c:43
#3 0x5576b5970e61 in varsub src/1_parser/parser_param_func/lexer_var_sub.c:74
#4 0x5576b597089b in line_parser src/1_parser/parser.c:98
#5 0x5576b596fadd in main src/main.c:48
#6 0x7f8dbbc5c09a in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: 2 byte(s) leaked in 1 allocation(s).
Insert path in part line lexer error
vec_insert in line lexer is not working to examine
Console wrap text
Issue
The console wrapping text don't work for the first new line.
Screen.Recording.2022-06-03.at.4.03.36.PM.mov
Todo
-
Try other student repo. -
Ask on stackoverflow
Env update
need to update env eatch new prompt
REMOVE MACRO FROM T_VEC_INIT !!!!!!!!!!!!!!!!!!!!!!!!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.