Skip to content

Conversation

@arkq
Copy link
Contributor

@arkq arkq commented Oct 24, 2025

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.

This PR is part of draft #16238

Testing

Verified locally that now, on the host with CDPATH set, it is possible to list and run commands when outside repo dir:

$ ONE/nnas
Usage: ONE/nnas [COMMAND] ...
Command:
  copyright-check
  ...
  verify-package
$ ONE/nncc configure
-- The C compiler identification is GNU 13.3.0
  ...
$ ONE/nnfw configure
-- Building for x86-64 Linux
  ...

ONE-DCO-1.0-Signed-off-by: Arkadiusz Bokowy a.bokowy@samsung.com

hseok-oh
hseok-oh previously approved these changes Oct 27, 2025
Copy link
Contributor

@hseok-oh hseok-oh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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>
@arkq
Copy link
Contributor Author

arkq commented Nov 2, 2025

@seanshpark all comments have been addressed, please re-review :)

Copy link
Contributor

@hseok-oh hseok-oh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hseok-oh hseok-oh merged commit a054e34 into Samsung:master Nov 4, 2025
14 checks passed
@arkq arkq deleted the bash-cd-fix-infra branch November 4, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants