resolution tests cd_bindir, cd_home, et b_env sauf une vraie erreur

This commit is contained in:
Hugo LAMY
2021-12-21 21:26:29 +01:00
parent 5c15813845
commit 0878b9b7e9
5 changed files with 200 additions and 108 deletions

View File

@@ -1,45 +0,0 @@
cd /bin
pwd
cd /bin/../
pwd
cd /
pwd
cd /bin
pwd
cd /
pwd
cd //bin
pwd
cd //
pwd
cd //bin
pwd
cd ///
pwd
cd ///bin
pwd
cd ////
pwd
cd ////bin
pwd
cd /////
pwd
cd /////bin
pwd
cd //////
pwd
cd //////bin
pwd
cd ///////
pwd
cd ///////bin
pwd

View File

@@ -3,14 +3,6 @@ cd
cd ../../../../../././././../../../././../../../
pwd
export HOME=//
cd
pwd
export HOME=//bin/..////////////bin/../
cd
pwd
export HOME=///
cd
pwd

View File

@@ -153,93 +153,53 @@ env | grep -v -E '^_=' | sort
cd ../
env | grep -v -E '^_=' | sort
export | grep -v -E '^declare -x _='
env
env | grep -v -E '^declare -x _='
export 1 _+ _OK _2? _OK2=VAR =NG OK3=
export | grep -v -E '^declare -x _='
env
env | grep -v -E '^declare -x _='
export dquote='"' dollar='$' backslash='\' backquote='`' newline='\n'
export | grep -v -E '^declare -x _='
env
export APPEND=1
export APPEND+=2
export | grep APPEND
env
env | grep -v -E '^declare -x _='
export APPEND_NONE=1
export APPEND_NONE+=
export | grep APPEND_NONE
env
env | grep APPEND_NONE
export APPEND_NONE=
export APPEND_NONE=
export APPEND_NONE+=
export | grep APPEND_NONE
env
env | grep APPEND_NONE
export APPEND_EMPTY=""
export APPEND_EMPTY=""
export APPEND_EMPTY=""
export | grep APPEND_EMPTY
env
env | grep APPEND_EMPTY
export OVERWRITE=42
export OVERWRITE=a
export | grep OVERWRITE
env
env | grep OVERWRITE
export A=B=C=D
export | grep A
env
env | grep A
export PATH
export | grep PATH
env
env | grep PATH
export PWD
export | grep PWD
env
env | grep PWD
export OLDPWD
export | grep OLDPWD
env
unset PWD
cd ..
export | grep PWD
env
unset OLDPWD
cd ..
export | grep OLDPWD
env
unset PWD
cd ..
export PWD=new_value
export | grep PWD
env
env | grep OLDPWD
unset OLDPWD
cd ..
export OLDPWD=new_value
export | grep OLDPWD
env
unset PWD
cd ..
export PWD
export | grep PWD
env
env | grep OLDPWD
unset OLDPWD
cd ..
export OLDPWD
export | grep OLDPWD
env
env | grep OLDPWD
export =
env

View File

@@ -10,6 +10,191 @@ cat Makefile | grep pr | head -n 5 | hello (NA)
echo $?
#---------------------------------------------
# export PWD et OLDPWD ne dependent pas des meme action que bash
# (dans bash : cd ne creer pas PWD, et OLDPWD n'existe que si PWD existe)
unset PWD
cd ..
env | grep PWD
unset OLDPWD
cd ..
env | grep OLDPWD
unset PWD
cd ..
export PWD=new_value
env | grep PWD
unset PWD
cd ..
export PWD
env | grep PWD
#---------------------------------------------
# export ne reconnait pas +=
export APPEND=1
export APPEND+=2
env | grep APPEND
#---------------------------------------------
# export seul n'affiche pas les variables d'env
export | grep -v -E '^declare -x _='
env
export 1 _+ _OK _2? _OK2=VAR =NG OK3=
export | grep -v -E '^declare -x _='
env
export dquote='"' dollar='$' backslash='\' backquote='`' newline='\n'
export | grep -v -E '^declare -x _='
env
export APPEND=1
export APPEND+=2
export | grep APPEND
env
export APPEND_NONE=1
export APPEND_NONE+=
export | grep APPEND_NONE
env
export APPEND_NONE=
export APPEND_NONE=
export APPEND_NONE+=
export | grep APPEND_NONE
env
export APPEND_EMPTY=""
export APPEND_EMPTY=""
export APPEND_EMPTY=""
export | grep APPEND_EMPTY
env
export OVERWRITE=42
export OVERWRITE=a
export | grep OVERWRITE
env
export A=B=C=D
export | grep A
env
export PATH
export | grep PATH
env
export PWD
export | grep PWD
env
export OLDPWD
export | grep OLDPWD
env
unset PWD
cd ..
export | grep PWD
env
unset OLDPWD
cd ..
export | grep OLDPWD
env
unset PWD
cd ..
export PWD=new_value
export | grep PWD
env
unset OLDPWD
cd ..
export OLDPWD=new_value
export | grep OLDPWD
env
unset PWD
cd ..
export PWD
export | grep PWD
env
unset OLDPWD
cd ..
export OLDPWD
export | grep OLDPWD
env
#---------------------------------------------
# cd /bin redirects to /usr/bin
cd /bin
pwd
cd /bin/../
pwd
cd /
pwd
cd /bin
pwd
cd /
pwd
cd //bin
pwd
cd //
pwd
cd //bin
pwd
cd ///
pwd
cd ///bin
pwd
cd ////
pwd
cd ////bin
pwd
cd /////
pwd
cd /////bin
pwd
cd //////
pwd
cd //////bin
pwd
cd ///////
pwd
cd ///////bin
pwd
#---------------------------------------------
# https://stackoverflow.com/questions/20690828/what-does-double-slash-in-cd-mean-in-linux
# pathname with two slashes
export HOME=//
cd
pwd
export HOME=//bin/..////////////bin/../
cd
pwd
#---------------------------------------------
# Race condition, unpredictable behaviour

View File

@@ -285,8 +285,8 @@ cd $(dirname $0)
# for env, special treatment
if [ "${in_file: -6}" == "env.sh" ]
then
bash_execution="$( echo "$bash_execution" | sort | grep -v -e "LINES=" -e "COLUMNS=" -e "_=" -e"LESSCLOSE=" -e "LESSOPEN=" )"
minishell_execution="$( echo "$minishell_execution" | sort | grep -v -e "LINES=" -e "COLUMNS=" -e "_=" -e"LESSCLOSE=" -e "LESSOPEN=" )"
bash_execution="$( echo "$bash_execution" | sort | grep -v -e "LINES=" -e "COLUMNS=" -e "_=" -e"LESSCLOSE=" -e "LESSOPEN=" -e "SHLVL=" )"
minishell_execution="$( echo "$minishell_execution" | sort | grep -v -e "LINES=" -e "COLUMNS=" -e "_=" -e"LESSCLOSE=" -e "LESSOPEN=" -e "SHLVL=" )"
fi
compare_output "$bash_execution" "$minishell_execution" "$commands"