Skip to content

Commit c175e8e

Browse files
committed
Discard output from the cd command when followed by pwd
This commits fixes the issue when `cd` is followed by the `pwd` in a bash one-liner which should get the directory in which the executed script is located. The problem with such approach is that the `cd` command can print the destination directory in case when one has the CDPATH environmental variable set. From the `man bash`: > cd [-L|...] [dir] > Change the current directory to dir. [...] If a non-empty directory > name from CDPATH is used the absolute pathname of the new working > directory is written to the standard output. ONE-DCO-1.0-Signed-off-by: Arkadiusz Bokowy <a.bokowy@samsung.com>
1 parent 47e9b47 commit c175e8e

File tree

110 files changed

+214
-216
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+214
-216
lines changed

circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_import_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
set -e
1212

13-
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1414

1515
MODEL_NAME="$1"; shift
1616

circle-mlir/circle-mlir/tools-test/circle-impexp-test/run_value_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
set -e
1414

15-
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1616

1717
VENV_PATH="$1"; shift
1818
MODEL_NAME="$1"; shift

circle-mlir/circle-mlir/tools-test/gen-onnx/run_gen_onnx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# model_name : name of model
1111
# onnx_name : name of onnx file
1212

13-
THIS_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
THIS_SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1414
PY_SCRIPT_PATH="${THIS_SCRIPT_PATH}/run_gen_onnx.py"
1515

1616
VENV_PATH="$1"; shift

circle-mlir/circle-mlir/tools-test/onnx2circle-rewrite-test/run_circle_ops_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
set -e
1212

13-
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1414

1515
VENV_PATH="$1"; shift
1616
RUN_PATH="$1"; shift

circle-mlir/circle-mlir/tools-test/onnx2circle-value-test/run_value_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
set -e
1515

16-
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16+
TEST_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1717

1818
VENV_PATH="$1"; shift
1919
MODEL_NAME="$1"; shift

circle-mlir/circle-mlir/tools/one-import-onnx-ext/one-import-onnx-ext

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env bash
2-
''''export SCRIPT_PATH="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)" # '''
3-
''''export PY_PATH=${SCRIPT_PATH}/venv/bin/python # '''
4-
''''test -f ${PY_PATH} && exec ${PY_PATH} "$0" "$@" # '''
5-
''''echo "Error: Virtual environment not found. Please run 'one-prepare-venv' command." # '''
6-
''''exit 255 # '''
2+
''''export SCRIPT_PATH="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" >/dev/null && pwd)" # '''
3+
''''export PY_PATH=${SCRIPT_PATH}/venv/bin/python # '''
4+
''''test -f ${PY_PATH} && exec ${PY_PATH} "$0" "$@" # '''
5+
''''echo "Error: Virtual environment not found. Please run 'one-prepare-venv' command." # '''
6+
''''exit 255 # '''
77

88
# Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
99
#

circle-mlir/infra/overlay/prepare-venv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434

3535
set -e
3636

37-
DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
37+
DRIVER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
3838
if [[ -z "$VENV_NAME" ]]; then
3939
VENV_NAME="venv"
4040
fi

circle-mlir/infra/tools/gen-coverage-report

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# COVERAGE_PATH : path where coverage report is generated,
77
# default is ${PROJECT_PATH}/${COVERAGE_RPATH}
88

9-
PROJECT_PATH="$(cd $(dirname ${BASH_SOURCE[0]})/../.. && pwd)"
9+
PROJECT_PATH="$(cd $(dirname ${BASH_SOURCE[0]})/../.. >/dev/null && pwd)"
1010

1111
# Set BUILD_WORKSPACE_RPATH with default 'build/coverage' if not set
1212
BUILD_WORKSPACE_RPATH="${BUILD_WORKSPACE_RPATH:-build/coverage}"

compiler/circle-part-value-test/part_eval_all.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# work_dir : artifacts directoy where test materials exist
1111
# venv_dir : python virtual environment home directory
1212

13-
VERIFY_SOURCE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
VERIFY_SOURCE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
1414
VERIFY_SCRIPT_PATH="${VERIFY_SOURCE_PATH}/part_eval_one.py"
1515
WORKDIR="$1"; shift
1616
VIRTUALENV="$1"; shift
@@ -25,7 +25,7 @@ for TESTCASE in "$@"; do
2525

2626
# for simplicity, folder uses same ${TESTCASE}
2727
TESTCASE_FOLDER="${WORKDIR}/${TESTCASE}"
28-
28+
2929
PASSED_TAG="${TESTCASE_FOLDER}.passed"
3030
rm -f "${PASSED_TAG}"
3131

compiler/circle-quantizer-dredd-recipe-test/testall.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [[ $# -lt 2 ]]; then
1313
exit 255
1414
fi
1515

16-
WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
16+
WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
1717
CONFIG_PATH="$1"; shift
1818
RESOURCE_DIR="$1"; shift
1919

0 commit comments

Comments
 (0)