Subject: unexpected behavior with /etc/pdsh/rcmd_default
Package: pdsh
Version: 2.14-2
Severity: minor

Debian pdsh is a shell script that checks for /etc/pdsh/rcmd_default and then sets PDSH_RCMD_TYPE equal to the contents of this file.

It does this without checking to see if PDSH_RCMD_TYPE is already set.

This means rcmd_default does NOT set the default rcmd, but rather overrides the current environment.

Note: it does NOT override -R on the command line, just the environment setting.

The name is not as clear as it could be.

Also, if you are going to require spawning a shell, and reading a conf file each time the command is run, it might be a better idea to have a /etc/pdsh/pdsh.env file or similar with contents such as:

# /etc/pdsh/pdsh.env
# These settings will OVERRIDE any user environment variables
#PDSH_RCMD_TYPE=rsh
#PDSH_SSH_ARGS=
#PDSH_SSH_ARGS_APPEND=
#WCOLL=
#DSHPATH=
#FANOUT=32

With all options commented out, and perhaps a comment in the file that these settings will OVERRIDE any user set environment variables. Then source that file in /usr/bin/pdsh thusly:

#! /bin/sh
if test -r /etc/pdsh/pdsh.env; then
  . /etc/pdsh/pdsh.env
  export PDSH_RCMD_TYPE PDSH_SSH_ARGS PDSH_SSH_ARGS_APPEND
  export WCOLL DSHPATH FANOUT
fi
exec -a pdsh /usr/bin/pdsh.bin "$@"

example uses two exports just to avoid wrapping. It could just source the file then send the variables all on one line:

#! /bin/sh
if test -r /etc/pdsh/pdsh.env; then
  . /etc/pdsh/pdsh.env
fi
PDSH_RCMD_TYPE="$PDSH_RCMD_TYPE" \
 PDSH_SSH_ARGS="$PDSH_SSH_ARGS" \
 PDSH_SSH_ARGS_APPEND="$PDSH_SSH_ARGS_APPEND" \
 WCOLL="$WCOLL" \
 DSHPATH="$DSHPATH" \
 FANOUT="$FANOUT" \
 exec -a pdsh /usr/bin/pdsh.bin "$@"

This avoids the export which might effect the current shell if someone were to try:

. /usr/bin/pdsh <somecommand>

currently.

You might want to keep backwards compatibility in there thusly:

#! /bin/sh
if test -r /etc/pdsh/pdsh.env; then
  . /etc/pdsh/pdsh.env
fi
if test -r /etc/pdsh/rcmd_default; then
 PDSH_RCMD_TYPE=`cat /etc/pdsh/rcmd_default`
fi
PDSH_RCMD_TYPE="$PDSH_RCMD_TYPE" \
 PDSH_SSH_ARGS="$PDSH_SSH_ARGS" \
 PDSH_SSH_ARGS_APPEND="$PDSH_SSH_ARGS_APPEND" \
 WCOLL="$WCOLL" \
 DSHPATH="$DSHPATH" \
 FANOUT="$FANOUT" \
 exec -a pdsh /usr/bin/pdsh.bin "$@"

In any case, it would be good to move to /bin/sh instead of /bin/bash

Thanx!

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (700, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-timriker (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages pdsh depends on:
ii  debconf          1.5.22     Debian configuration management sy
ii  genders          1.6-1-1+b1 cluster configuration management d
ii  libc6            2.7-12     GNU C Library: Shared libraries
ii  libgenders0      1.6-1-1+b1 C library for parsing and querying
ii  openssh-client   1:4.7p1-12 secure shell client, an rlogin/rsh
ii  perl             5.10.0-10  Larry Wall's Practical Extraction
ii  ssh              1:4.7p1-12 secure shell client and server (me

pdsh recommends no packages.

-- debconf information:
* pdsh/setuidroot: true

--
Tim Riker - http://Rikers.org/ - [EMAIL PROTECTED]
Embedded Linux Technologist - http://eLinux.org/
BZFlag maintainer - http://BZFlag.org/ - for fun!
☢ ☛ ¿ǝʇɐɔıʇǝu pooƃ ǝɹnʇɐuƃıs ɹnoʎ uı 8-ɟʇn sı ☚ ☢



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to