aeb5105d97
tests(redir): ensure targets are expanded when no words are in the cmd
2025-04-28 16:28:04 +02:00
d4da91b62b
fix(exec): do now swallow prompt and io on incorrect command followed by redirection
2025-04-28 16:07:08 +02:00
65c1eb9d84
fix(connec_cmd): handle nested connections correctly
2025-04-28 15:12:17 +02:00
92d647e33c
feat(redirections): allow a command composed only of redirections
2025-04-28 14:44:20 +02:00
a9055b4c66
feat(redirection/group_cmd): handle redirections for group cmds
2025-04-28 13:01:08 +02:00
Jérôme Guélen
71eb07b4f5
(fix) Test was missing an EOF
2025-04-28 11:55:45 +02:00
Jérôme Guélen
32dd807c9d
(fix/enhancement): Added two tests for behaviour when not file corresponds
2025-04-28 11:50:36 +02:00
Jérôme Guélen
25ffc3fb6f
(fix): Proper behaviour for wildcards and proper test
2025-04-28 11:50:36 +02:00
Jérôme Guélen
e5952b3f43
Behaviour seems inconsistent
2025-04-28 11:50:32 +02:00
f0f19c3c0a
fix(exec/and or): was exiting too soon
2025-04-25 18:03:12 +02:00
e1801652af
fix(parsing/subshell): missing allocation for group cmd
2025-04-25 17:52:51 +02:00
9fcb34e1d5
feat(builtins/cd): on error, print path
2025-04-25 16:08:10 +02:00
29bbb5e572
fix(command_not_found): unset or empty PATH leads to No such file or directory error
2025-04-25 15:52:02 +02:00
c756d3783f
tests(export): ensure export rejects invalid identifiers
2025-04-25 15:14:48 +02:00
c4be8693d1
tests(export): ensure export with extra = works
2025-04-25 15:10:05 +02:00
553783eb2d
fix(tests): remove dependency on $HOME
2025-04-25 15:06:42 +02:00
f6ae16bbf8
tests(var_subst): ensure commands partially in variables work
2025-04-25 15:06:42 +02:00
a040ad5613
tests(export): ensure previous value of variable works correctly
2025-04-25 15:06:42 +02:00
Jérôme Guélen
29187f08da
tests(export/echo): ensure correct behaviour for single quotes in VAR
2025-04-25 15:01:54 +02:00
08baee41b6
tests(echo): ensure arguments in variables work
2025-04-25 14:40:09 +02:00
e5027323e1
fix(field_splitting): ensure no extraneous spaces appear
...
debug notes:
= 250 !! OK ===================================================================
export HOLA="bonjour "
echo $HOLA | cat -e
= out =
bonjour $
= err =
rc: 0
= refout =
bonjour$
++++++++++++++++++++++++++++++++++++++++++++++++++++
failed: quote removal before word splitting
++++++++++++++++++++++++++++++++++++++++++++++++++++
++++ test input:
export VAR="hello "
echo $VAR | cat -e
++++ Got output:
hello $
++++ But expected:
hello$
Problem is in post-processing:
parsed command
╰─ t_cmd
├─ t_cmd_type = FT_SIMPLE
├─ flags = 0
├─ line = 0
╰─ value
╰─ t_simple_cmd
├─ line = 0
├─ t_wordlist
│ ├─ t_worddesc
│ │ ├─ word = [echo]
│ │ ├─ marker = [ ]
│ │ ├─ flags = 0
│ │ ╰─ t_token_type = WORD_TOKEN
│ ╰─ t_worddesc
│ ├─ word = [$VAR]
│ ├─ marker = [ ]
│ ├─ flags = 1
│ ╰─ t_token_type = WORD_TOKEN
╰─ redirections = (empty redir list)
about to post-process
╰─ t_simple_cmd
├─ line = 0
├─ t_wordlist
│ ├─ t_worddesc
│ │ ├─ word = [echo]
│ │ ├─ marker = [ ]
│ │ ├─ flags = 0
│ │ ╰─ t_token_type = WORD_TOKEN
│ ╰─ t_worddesc
│ ├─ word = [$VAR]
│ ├─ marker = [ ]
│ ├─ flags = 1
│ ╰─ t_token_type = WORD_TOKEN
╰─ redirections = (empty redir list)
about to post-process
╰─ t_simple_cmd
├─ line = 0
├─ t_wordlist
│ ├─ t_worddesc
│ │ ├─ word = [echo]
│ │ ├─ marker = [ ]
│ │ ├─ flags = 0
│ │ ╰─ t_token_type = WORD_TOKEN
│ ╰─ t_worddesc
│ ├─ word = [hello ]
│ ├─ marker = [$$$$$$]
│ ├─ flags = 1
│ ╰─ t_token_type = WORD_TOKEN
╰─ redirections = (empty redir list)
about to post-process
╰─ t_simple_cmd
├─ line = 0
├─ t_wordlist
│ ├─ t_worddesc
│ │ ├─ word = [echo]
│ │ ├─ marker = [ ]
│ │ ├─ flags = 0
│ │ ╰─ t_token_type = WORD_TOKEN
│ ├─ t_worddesc
│ │ ├─ word = [hello]
│ │ ├─ marker = [$$$$$]
│ │ ├─ flags = 1
│ │ ╰─ t_token_type = WORD_TOKEN
│ ╰─ t_worddesc <---- WHAT IS THIS DOING HERE???
│ ├─ word = []
│ ├─ marker = []
│ ├─ flags = 1
│ ╰─ t_token_type = WORD_TOKEN
╰─ redirections = (empty redir list)
about to post-process
╰─ t_simple_cmd
├─ line = 0
├─ t_wordlist
│ ├─ t_worddesc
│ │ ├─ word = [echo]
│ │ ├─ marker = [ ]
│ │ ├─ flags = 0
│ │ ╰─ t_token_type = WORD_TOKEN
│ ├─ t_worddesc
│ │ ├─ word = [hello]
│ │ ├─ marker = [$$$$$]
│ │ ├─ flags = 1
│ │ ╰─ t_token_type = WORD_TOKEN
│ ╰─ t_worddesc
│ ├─ word = []
│ ├─ marker = []
│ ├─ flags = 1
│ ╰─ t_token_type = WORD_TOKEN
╰─ redirections = (empty redir list)
about to execute
╰─ t_simple_cmd
├─ line = 0
├─ t_wordlist
│ ├─ t_worddesc
│ │ ├─ word = [echo]
│ │ ├─ marker = [(null)]
│ │ ├─ flags = 0
│ │ ╰─ t_token_type = WORD_TOKEN
│ ├─ t_worddesc
│ │ ├─ word = [hello]
│ │ ├─ marker = [(null)]
│ │ ├─ flags = 1
│ │ ╰─ t_token_type = WORD_TOKEN
│ ╰─ t_worddesc
│ ├─ word = []
│ ├─ marker = [(null)]
│ ├─ flags = 1
│ ╰─ t_token_type = WORD_TOKEN
╰─ redirections = (empty redir list)
Problem seems to be in field splitting
2025-04-25 14:32:16 +02:00
588b016f69
tests(export): ensure variable substitution in variable names works
2025-04-25 13:41:43 +02:00
45869f1154
tests(export): ensure @ is accepted in variable values
2025-04-25 13:36:28 +02:00
297d68e73c
tests(parsing): ensure unmatched ) are correctly reported
2025-04-25 13:33:09 +02:00
0c9dcd944e
fix(parsing): report unclosed ( error
2025-04-25 13:19:44 +02:00
527a624765
fix(exec): return code 126 when command is found but permission denied
2025-04-25 12:40:34 +02:00
Jérôme Guélen
a86616f910
(enhancement) Printing an error on unclosed quote and corrected a typo.
2025-04-24 17:20:04 +02:00
9db47dc96d
feat(redirection): print path of redirection target on redirection error
2025-04-24 13:42:31 +02:00
b6e97ac2c7
fix(debug): redirectee prints both variants of an enum
2025-04-24 13:34:39 +02:00
8d60113351
feat(postprocess/redir): remove quotes in redirection targets
2025-04-24 12:45:00 +02:00
2180909285
fix(expansion/wildcard): do not remove quotes twice on non-pattern strings
...
There is still an issue with removing too many quotes when expanding variables
(see #138 ). This will be tackled in a later PR.
2025-04-24 12:45:00 +02:00
aca85c3583
fix(expansion/redirection): prevent infinite loop of redir list pointing to itself
...
also add a hard limit of OVER 9000! iterations for the problematic loop
2025-04-24 12:45:00 +02:00
bf26afce2b
fix(debug): correctly print here_doc_eof in redirect debug
2025-04-24 12:45:00 +02:00
38ffac7fc3
feat(redir): expand wildcards in targets and handle ambiguous redirects
2025-04-24 12:45:00 +02:00
2dd20b21bc
feat(redir): fieldsplit redir target, and handle ambiguous redirects
2025-04-24 12:44:33 +02:00
c00cc21ae4
feat(redirect): do variable expansion on redirect targets
2025-04-21 08:17:22 +02:00
1499eaa985
test(builtin/export): ensure that variable substitution happens correctly
2025-04-18 10:37:49 +02:00
5fabec58d5
test(builtin/export): ensure that identifiers are correctly accepted or rejected
2025-04-18 10:30:21 +02:00
c5e15903e0
fix(builtin/export): show error on invalid identifiers such as % and $
2025-04-18 10:17:21 +02:00
efaf4708f9
fix(builtin/export): empty arguments were not identified as invalid identifiers
2025-04-18 10:03:09 +02:00
6b2e15d301
test: migrate some tests from zms_testeur
2025-04-18 09:57:41 +02:00
d44691a5b0
fix(exec): running a command with an absolute path which does not exist now gives correct error
...
Before, it gave "Is a directory" error, but now it correctly gives "No such file
or directory".
2025-04-18 09:25:11 +02:00
655ff36351
fix(susbt/variable): empty variables on their own are removed
2025-04-18 09:22:18 +02:00
9271b7fa92
fix(parsing/pipeline): leak when optional pipeline returns NULL
2025-04-18 09:19:25 +02:00
5e6d7b3b4e
fix(parsing/here_doc): segfault & invalid fd & premature exit
2025-04-17 11:25:59 +02:00
3be2969946
fix(parsing/simple_cmd): leak when invalid redirection after word in simple_cmd
2025-04-16 18:21:33 +02:00
49a897b44e
subst/variable: remove special handling of positional variables
...
Including only half support does not make sense, it could cause more problems
than it solves.
2025-04-16 18:05:11 +02:00
d53e40d3f4
fix(subst/variable): invalid identifiers were having their $ swallowed
...
It is safe to delete this part:
```c
if (!rep)
return (NULL);
```
because rep is always returned, and no other code depends on that value
2025-04-16 17:50:23 +02:00
733ae1093a
fix(exec): correctly exit subprocesses, do not keep multiple shells in parallel
2025-04-16 17:30:25 +02:00
96e46e9130
fix(parsing/cmdgroup): report error the same way as everywhere else, prevent double report
...
before:
```
$ ()
minishell: syntax error near unexpected token `)'
minishell: syntax error near unexpected token `)'
```
after:
```
$ ()
minishell: syntax error near unexpected token `)'
```
This probably fixes a few bugs as well, but I didn't look too hard. It just
seemed nicer to have a consistent way to report errors.
2025-04-16 15:52:22 +02:00