Commit graph

110 commits

Author SHA1 Message Date
ccbd89708f tests: add simple reproducer for cmdlist use-after-free 2025-03-10 13:22:29 +00:00
d303f22b73 wip: tests: show more debug information 2025-03-10 13:22:29 +00:00
c57a4a69a7 WIP: parse command list tests: assert that invalid pipeline returns null 2025-03-10 13:22:29 +00:00
5fceb4713d command list refactor: rename t_command_list to t_cmdlist 2025-03-10 13:22:29 +00:00
659c9f57ff command list parse: different operators 2025-03-10 13:22:29 +00:00
1c00020c86 command list parse: handle triple pipeline separated with || 2025-03-10 13:22:29 +00:00
e6dd1d6a56 command list parse: handle two commands separated by || 2025-03-10 13:22:29 +00:00
36fa53131a command list parse: handle single pipeline 2025-03-10 13:22:29 +00:00
3b36a77d34 command list parse: handle two commands separated by && 2025-03-10 13:22:29 +00:00
eb21f00156 command list parsing: handle empty input
This is really not that usefull, it is more to setup the groundwork
2025-03-10 13:22:29 +00:00
836e24bcb7
quote removal: ensure quotes in middle of word are correctly handled 2025-03-07 11:25:27 +01:00
94e55d1d8b
quote removal: handle nested quotes 2025-03-07 11:21:13 +01:00
a3d2143b8b
quote removal: handle non-nested quotes 2025-03-07 11:15:30 +01:00
7b76c1a71f
quote removal: if given null, return null 2025-03-07 11:09:32 +01:00
0fecded23b
quote removal: handle strings with no quotes 2025-03-07 11:09:21 +01:00
4f6910eccd
quote detection: ensure the rest of the test cases pass 2025-03-06 17:21:09 +01:00
f60e922680
quote marking: ensure that $ detection does not interfere 2025-03-06 17:21:09 +01:00
33fc88eeed
quote marking: ensure that operator detection does not interfere 2025-03-06 17:21:08 +01:00
3a341e601d
quote marking: ensure that mixed quotes also work 2025-03-06 17:21:08 +01:00
616cb0bc09
quote marking: ensure that double quotes also work 2025-03-06 17:21:08 +01:00
c1f337af01
quote marking: single-quotes are marked 2025-03-06 17:21:08 +01:00
14dbabd6ea
testutil: add leak check function 2025-03-06 17:20:52 +01:00
e2b6f6f943
testutil: more clear output of assert_strequal
the strings are one above the other, and aligned correctly
2025-03-06 17:20:52 +01:00
2c5d5abdc4
quote marking: no quotes lead to marker filled with spaces 2025-03-06 17:20:52 +01:00
4b403c4bf3
pipeline parse: reject hanging pipe at end
This rejects commands such as

echo hello | cat -e |

I also updated the doc this time
2025-02-28 13:15:11 +01:00
a8711568c1
pipeline parse: detect and reject pipe at start of command 2025-02-24 15:22:40 +01:00
c9f8c5a4f9
pipeline: reject repetitions of '|' token 2025-02-24 14:56:16 +01:00
68e923c09e
pipeline: ensure that parsing works for three and four commands 2025-02-24 14:56:16 +01:00
5f1485d1d5
pipeline: parse basic pipeline commands with two commands 2025-02-24 14:56:16 +01:00
256a8f5f9b
pipeline: handle parsing of single-command pipelines 2025-02-24 14:56:16 +01:00
695596fde2
wordsplit flags: also set W_HASDOLLAR if dollar is found in double quotes
Fixes #15
2025-02-24 14:51:26 +01:00
a50b2f6d74
simple_cmd: actually contain words 2025-02-21 12:52:27 +01:00
49d7a2b9ff
simple_cmd: initial setup of create/destroy functions 2025-02-21 12:44:17 +01:00
abf37eb7f5
wordsplit: set quote and dquote flags 2025-02-20 15:39:03 +01:00
ac8475c71d
wordsplit: implemet rule for variable substitution detection (rule 5) 2025-02-20 15:00:48 +01:00
f92763e479
wordsplit: handle operators 2025-02-20 15:00:32 +01:00
558ddb4096
wordsplit: return error for unclosed quotes 2025-02-20 15:00:32 +01:00
7806043a98
wordsplit: ensure that mixed broken quotes are handled correctly 2025-02-20 15:00:32 +01:00
452d35acdf
wordsplit: handle mixed quotes 2025-02-20 15:00:32 +01:00
1676cf6696
wordsplit: handle double quotes 2025-02-20 15:00:32 +01:00
5276aba278
wordsplit: handle single quotes 2025-02-20 15:00:32 +01:00
db0abe82cc
tests: also show debug info for succeeding assertions
This reminds us of all the good stuff we already acomplished!
2025-02-20 15:00:32 +01:00
4171a3d07b
wordsplit: handle multiple words 2025-02-20 15:00:11 +01:00
00fd2380cf
wordsplit: handle a sigle word separated surrounded by blanks
a blank here is as defined by POSIX
https://pubs.opengroup.org/onlinepubs/9699919799/
section 7.3.1
2025-02-20 15:00:11 +01:00
8defbf4d13
wordsplit: handle single word with spaces before or after 2025-02-20 14:55:29 +01:00
fc985ea046
fix(tests): also run tests if test program did not change 2025-02-20 14:55:29 +01:00
a083800506
word splitting: a single word is not split
Sorry this commit is a bit big, lots of groudwork is being established here
2025-02-20 14:55:29 +01:00
871571e258
tests: more clear output log 2025-02-20 14:47:31 +01:00
dff68d5a8b
env refactor: split imports over multiple files
This allows for potentially faster recompilation, by not triggering
recompilation for all env files if env_manip changes
2025-02-19 16:43:37 +01:00
e445f668b3
env_manip: sort funcs per structure that is being manipulated
This is instead of the operation that is being performed.

I find it more logical this way, but if you prefer we can keep it as-is.

I also put the identifier_isvalid func into parser/matchers
2025-02-19 14:47:10 +01:00