Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect behavior of cd ../.foo #46

Merged
merged 1 commit into from
Jun 26, 2020
Merged

Conversation

JohnoKing
Copy link

The cd builtin was removing . from directory names when combined with a preceding ../, which caused commands like cd ../.local to become cd ../local. This patch fixes the problem by limiting the extra handling to leading ... The bugfix comes from ksh93v- 2013-10-10-alpha, although this version is a shortened patch from Solaris (as ksh93v- refactored a decent amount of the code for the cd builtin).

Patch from Solaris:
https://github.com/oracle/solaris-userland/blob/860d27f/components/ksh93/patches/270-23319761.patch

The cd builtin was removing '.' from directory names when combined
with a preceding '../', which caused commands like 'cd ../.local'
to become 'cd ../local'. This patch fixes the problem by limiting
the extra handling to leading '..'. The bugfix comes from ksh93v-
2013-10-10-alpha, although this version is a shortened patch from
Solaris (as ksh93v- refactored a decent amount of the code for the
cd builtin).

src/cmd/ksh93/bltins/cd_pwd.c:
- cd should only check for leading '..', as trying to handle a lone
  '.' only causes problems.

src/cmd/ksh93/tests/builtins.sh:
- Add a regression test for this problem based on the test present in
  ksh93v- 2013-10-10-alpha.

Patch from Solaris:
https://github.com/oracle/solaris-userland/blob/860d27f/components/ksh93/patches/270-23319761.patch
@McDutchie McDutchie merged commit bb4745e into ksh93:master Jun 26, 2020
@JohnoKing JohnoKing deleted the cd-fix branch June 27, 2020 01:24
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.

2 participants