Skip to content

Commit 514f986

Browse files
HenryLin-pnghenry1.linilya-lavrenov
authored
CVS-98205 and CVS-114018 (openvinotoolkit#18592)
* Changed ls calls to /bin/ls, unset python_version before parsing cmd line * Update setupvars.sh Unset all temporary variables --------- Co-authored-by: henry1.lin <linhenry@ttoycron01u.tor.intel.com> Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
1 parent 58546b2 commit 514f986

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

scripts/setupvars/setupvars.sh

+16-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [ -e "$INSTALLDIR/runtime" ]; then
3535
export ngraph_DIR=$INSTALLDIR/runtime/cmake
3636
export OpenVINO_DIR=$INSTALLDIR/runtime/cmake
3737

38-
system_type=$(ls "$INSTALLDIR/runtime/lib/")
38+
system_type=$(/bin/ls "$INSTALLDIR/runtime/lib/")
3939
OV_PLUGINS_PATH=$INSTALLDIR/runtime/lib/$system_type
4040

4141
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -56,14 +56,15 @@ if [ -e "$INSTALLDIR/runtime" ]; then
5656
fi
5757
fi
5858

59-
if ls "$tbb_lib_path"/libtbb* >/dev/null 2>&1; then
59+
if /bin/ls "$tbb_lib_path"/libtbb* >/dev/null 2>&1; then
6060
if [[ "$OSTYPE" == "darwin"* ]]; then
6161
export DYLD_LIBRARY_PATH=$tbb_lib_path:${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
6262
fi
6363
export LD_LIBRARY_PATH=$tbb_lib_path:${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH}
6464
else
6565
echo "[setupvars.sh] WARNING: Directory with TBB libraries is not detected. Please, add TBB libraries to LD_LIBRARY_PATH / DYLD_LIBRARY_PATH manually"
6666
fi
67+
unset tbb_lib_path
6768

6869
if [ -e "$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB" ]; then
6970
export TBB_DIR=$INSTALLDIR/runtime/3rdparty/tbb/lib/cmake/TBB
@@ -77,6 +78,8 @@ if [ -e "$INSTALLDIR/runtime" ]; then
7778
echo "[setupvars.sh] WARNING: TBB_DIR directory is not defined automatically by setupvars.sh. Please, set it manually to point to TBBConfig.cmake"
7879
fi
7980
fi
81+
82+
unset system_type
8083
fi
8184

8285
# OpenCV environment
@@ -115,18 +118,22 @@ check_python_version () {
115118
echo "[setupvars.sh] WARNING: Unsupported Python version ${python_version}. Please install one of Python" \
116119
"${PYTHON_VERSION_MAJOR}.${MIN_REQUIRED_PYTHON_VERSION_MINOR} -" \
117120
"${PYTHON_VERSION_MAJOR}.${MAX_SUPPORTED_PYTHON_VERSION_MINOR} (64-bit) from https://www.python.org/downloads/"
121+
unset python_version
118122
return 0
119123
fi
124+
120125
if command -v python"$python_version" > /dev/null 2>&1; then
121126
python_interp=python"$python_version"
122127
else
123128
python_interp=python"$python_version_major"
124129
fi
125130
python_bitness=$("$python_interp" -c 'import sys; print(64 if sys.maxsize > 2**32 else 32)')
131+
unset python_interp
126132

127133
if [ "$python_bitness" != "" ] && [ "$python_bitness" != "64" ] && [ "$OS_NAME" != "Raspbian" ]; then
128134
echo "[setupvars.sh] WARNING: 64 bitness for Python $python_version is required"
129135
fi
136+
unset python_bitness
130137

131138
if [ -n "$python_version" ]; then
132139
if [[ -d $INTEL_OPENVINO_DIR/python ]]; then
@@ -154,4 +161,11 @@ else
154161
check_python_version
155162
fi
156163

164+
unset python_version
165+
unset python_version_to_check
166+
unset PYTHON_VERSION_MAJOR
167+
unset MIN_REQUIRED_PYTHON_VERSION_MINOR
168+
unset MAX_SUPPORTED_PYTHON_VERSION_MINOR
169+
unset OS_NAME
170+
157171
echo "[setupvars.sh] OpenVINO environment initialized"

0 commit comments

Comments
 (0)