Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-31875

ksh builtin pwd fails if shell starts with PWD not set to cwd

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • rhel-9.3.0
    • ksh
    • None
    • None
    • Moderate
    • rhel-sst-cs-plumbers
    • ssg_core_services
    • 3
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • x86_64
    • None

      What were you trying to do that didn't work?

      A customer upgraded from RHEL 7.9 to RHEL 9.3. My company's product triggered the buggy behavior on the new OS. It did so by (1) forking, and then in the forked child process (2) changing directory and (3) exec'ing a ksh script, which in turn executed the pwd command.

      Please provide the package NVR for which bug is seen:

      ksh-1.0.0~beta.1-3.el9.x86_64

      Not seen in ksh-1.0.0~beta.1-2.el9.x86_64 (in RHEL 9.2), so the bug is evidently a result of fixing bugzilla bug 2123066.

      How reproduceable

      Always.

      Steps to reproduce

      Either of the following command lines, run in any shell:

      • cd /tmp; env - ksh -c pwd
      • cd /tmp; env PWD=/ ksh -c pwd

      More generally, pretty much any value of PWD other than /tmp provokes the error.

      Expected results

      Standard output "/tmp". Status 0.

      Actual results

      Standard error "pwd: determine present working directory". Status 1.

      Comments

      This bug makes ksh non-POSIX-compliant. POSIX basically says that pwd should ignore PWD if it doesn't point to the cwd.

      It's pretty common for programs to change directory and spawn shell scripts without first setting PWD. GNU make is an example.

              vmihalko Vincent Mihalkovic
              55skendall Sam Kendall (Inactive)
              Vincent Mihalkovic Vincent Mihalkovic
              Karel Volný Karel Volný
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: