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
ced979dd31
fix(parsing/simple_cmd): report error the same way as everywhere else, prevent leak
2025-04-16 15:38:51 +02:00
18225f3356
fix(executing): return code on unknown cmd was unchanged, is now set to 127
2025-04-16 15:00:20 +02:00
9a32220945
redir_parsing: fix memory leak when parsing a redirection with an operator as specifier
...
if the specifier was not WORD_TOKEN, the operator was not being freed
2025-04-16 14:13:01 +02:00
942217a45a
tests: update tests to reflect new parser
2025-04-15 15:47:18 +02:00
81febcfcdd
debug: show command about to be executed in debug mode
2025-04-15 15:19:27 +02:00
3ec90f7770
token_type: assign token_type to worddesc during wordsplit
...
Also added some tests for that part.
2025-04-15 15:17:51 +02:00
4d6a64bf6a
debug: worddesc show more information
...
This seems appropriate since worddescs are getting more and more complex:
markers, flags, tokentypes, ...
2025-04-15 15:17:51 +02:00
386d2bcb3a
exec: correct error and return value when cmd is a directory
...
minishell: /: Is a directory
$? = 126
2025-04-15 15:11:50 +02:00
d08c9a6727
tests: check simple noops
2025-04-15 15:11:50 +02:00
be183b99ee
minishell: do wildcard expansion
2025-04-15 15:06:46 +02:00
32e3976774
field splitting: implement field splitting
2025-04-15 15:05:52 +02:00