[Bug 520591] [NEW] ksh uses the wrong PID for $$ when on the last line of a script

Dennis Williamson dennis at netstrata.com
Thu Feb 11 17:57:48 UTC 2010


Public bug reported:

Binary package hint: ksh

In the following script:

#!/bin/ksh93
ps -p $$
ps -p $$

The first line reports the process information for the script and the
second one does so for the ps itself. Adding nothing more than an empty
comment (or anything else even) after those two lines makes both ps
commands show the information for the script.

This also works incorrectly:

#!/bin/ksh93
ls -l /proc/$$/exe
ls -l /proc/$$/exe

The first one shows the symlink to /bin/ksh93 and the second shows a
symlink to ls. Again, adding a line after these with a comment or
another command causes the second ls to be the same as the first.

However, this one works as expected:

#!/bin/ksh93
ps -p $$
echo $$
echo $$

Both echos show the same PID as the ps.

In contrast, both Bash 4.0.33(1)-release and Dash work as expected.

$ lsb_release -rd
Description:    Ubuntu 9.10
Release:        9.10
$ apt-cache policy ksh
ksh:
  Installed: 93t+-2
  Candidate: 93t+-2
  Version table:
 *** 93t+-2 0
        500 http://mirror.cs.umn.edu karmic/universe Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
Architecture: i386
Date: Thu Feb 11 09:19:15 2010
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: nvidia
Package: ksh 93t+-2
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, user)
 LANG=en_US.UTF-8
ProcVersionSignature: Ubuntu 2.6.31-17.54-generic
SourcePackage: ksh
Uname: Linux 2.6.31-17-generic i686

** Affects: ksh (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386

-- 
ksh uses the wrong PID for $$ when on the last line of a script
https://bugs.launchpad.net/bugs/520591
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list