Package: procps
Version: 1:3.3.3-3
Severity: normal

What I do:

  I type "pwdx $$".

What I expect to happen:

  I expect pwdx to print the current working directory of my shell.

What actually happens:

  pwdx prints a message such as the following:

    pwdx: invalid process id: 18110

  The number is variable; it depends on the value of $$, of course;
  but the remainder of the message is always the same.

Further details:

  I make use of two PCs.  The above problem occurs on one of them
  (named albatross, the PC from which I am making this bug report),
  but not on the other.

Solution:

  I looked at the source code of pwdx, specifically, at the file pwdx.c
  in the Debian source package.  It is clear that there is a bug in the
  function check_pid_argument.

  That function calls strtol, in order to check that a certain string
  is a valid integer.  It then checks the value of errno.

  I have determined that, on albatross, errno has the value 2 before the
  call to strtol.  Therefore, the check of errno that follows the call to
  strtol concludes, mistakenly, that the string is not a positive integer.

  The fix for this is given in the man page for strtol.  To quote:

    the calling program should set errno to 0 before the call, and
    then determine if an error occurred by checking whether errno has
    a nonzero value after the call.

-- System Information:
Debian Release: 7.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_IE.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages procps depends on:
ii  initscripts   2.88dsf-41+deb7u1
ii  libc6         2.13-38+deb7u1
ii  libncurses5   5.9-10
ii  libncursesw5  5.9-10
ii  libprocps0    1:3.3.3-3
ii  libtinfo5     5.9-10
ii  lsb-base      4.1+Debian8+deb7u1

Versions of packages procps recommends:
ii  psmisc  22.19-1+deb7u1

procps suggests no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to