pscott / 42sh Goto Github PK
View Code? Open in Web Editor NEWPOSIX-inspired UNIX shell
POSIX-inspired UNIX shell
commande precedente.``` from 42sh's subject.
if you input something while it 'charging', the shell will output unwanted characters
Not very serious, but when we type exit
to exit the shell, it does not pop in the history
i think when a character is escaped, i don't change the LEN well
$> echo "bonsoir
c> bonjour"
$> echo bonsoir
c> bonjour
$> echo "bonsoir
c> bonjour
c> "
cd / ; cd bin
, when you use pwd
, it shows //bin
instead of /bin
When we use a command, it is written twice in the history
ctrl + d is supposed to delete a char, and if no char is in the line, to quit the shell, it does not work like this on 42sh
When we hit cmd + k to clear the terminal, the display is bugged and comes again to the place the line was before the cmd + k
> test
Segfault
Remember to remove the macro "ERROR_MEM", because it's not compatible with the 42 norm
echo " asd | " | ./42sh"
Protéger tous les retours de close, dup, dup2 ...
it does not print ls + the content of the file
to reproduce:
write some char in shell
then rapidly type:
$> env TEST="auteur srcs" ./42sh
42sh $ ls $TEST
21sh/redirections/inputs/001-close-stdin (FAILED)
Description:
The purpose of this test is to check that using the closing operator &-
within the STDIN redirection <
results in a closed standard input, so that read(2)
results in a read error.
Before test:
01: rm -f ./read_on_stdin
02: gcc -Wall -Werror -Wextra “/Users/aschoenh/42ShellTester/support/read-on-stdin/main.c” -o ./read_on_stdin
STDIN:
01: ./read_on_stdin <&-
STDOUT:
SUCCESS might be_empty
(no output)
STDERR:
FAILURE expected_to match_regex STDIN READ ERROR$
(no output)
MISC:
FAILURE expected_to exit_with_status 1
link : https://github.com/we-sh/42ShellTester/blob/master/spec/21sh/redirections/inputs/001-close-stdin
wc give wrong numbers
$ cat<auteur|wc
is put 2 time in history
21sh/redirections/inputs/005-no-such-file (FAILED)
Description:
The purpose of this test is to check that using a wrong path within the STDIN redirection <
results in an error.
Before test:
01: rm -f “./no_such_file”
STDIN:
01: ./read_on_stdin <no_such_file
STDOUT:
SUCCESS expected_to be_empty
(no output)
STDERR:
SUCCESS expected_to_not be_empty
SUCCESS might match_regex [Nn]o such file or directory
01: 42sh: no_such_file: No such file or directory
MISC:
FAILURE expected_to_not exit_with_status 0
link : https://github.com/we-sh/42ShellTester/blob/master/spec/21sh/redirections/inputs/005-no-such-file
Env -i is not done ; just a bit tricky because it influences the execution
When the brackets are not well formatted, the shell freezes and it's impossible to quit
When typed cat < doesnotexist
, the shell is not supposed to launch cat, but it does
21sh/separators/semicolon/003-parse-error-empty-inline-command (FAILED)
Description:
The purpose of this test is to check that using the simicolon separator ;
with empty commands results in error.
STDIN:
01: ./write_on_stdout TOKEN201906031740 ; ; ./exit_with_status 42
STDOUT:
SUCCESS expected_to be_empty
(no output)
STDERR:
SUCCESS expected_to_not be_empty
SUCCESS might match_regex ([Ss]yntax|[Pp]arse) error
01: 42sh: syntax error near unexpected token `;'
MISC:
SUCCESS expected_to_not exit_with_status 42
FAILURE expected_to_not exit_with_status 0
error msg
I suspect something is going wrong with the history pointer when we actually press enter... need to check with @aschoenh
&& ls
&&
| ls
|
These cases make the 42sh segfault
To help the user to use our shell, it would be interesting to show the termcaps possible actions and their shortcuts when the shell is launched, like a kind of header before printing the terminal in the beginning
cd doesnotexist 2 > test
infinite loop, shell is frozen and impossible to use
cat << EOF
${PW D}
EOF
example : ls
, uparrow, uparrow. LS gets added twice.
Le ctrl + d marche pas quand y'a un début de commande entré
21sh/pipe/006-exit-status (FAILED)
Description:
The purpose of this test is to check that the exit status of a pipeline command is the same as the last piped process.
STDIN:
01: ./sleep_and_exit_with_status 1 21 | ./exit_with_status 42
STDOUT:
(no output)
STDERR:
SUCCESS expected_to be_empty
(no output)
MISC:
FAILURE expected_to exit_with_status 42
Link du git pour voir les tests : https://github.com/we-sh/42ShellTester/tree/master/spec/21sh/pipe/006-exit-status
echo "coucou" > test ; cat 4< test
When you go up in the history, execute an unknown command, you stay in the line which you modified instead of having a new line at the bottom of the history
L’expansion simple des paramètres selon la syntaxe ${} (pas de format supplémentaire requis).
from 42sh's subject.
should we parse_quotes before sending it to arith_exp ?
Don't forget to remove the leaks in create_argv 💯 valgrind always says that argv is leaking
bash behavior : on empty line: press tab twice to ask for display
our behavior: press tab once to ask for display.
@aschoenh should we change ?
output proper message on multiple files on cd (cd a b
)
echo $LINES
echo $(($LINES))
When an unknown key is pressed (for example, a combination of keys who isn't supposed to do anything in 21sh, or a key like F16), the keycode is printed into the terminal instead of doing nothing
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.