Bug#353070: ssh-argv0 uses non-portable shell function
Package: ssh
Version: 1:3.8.1p1-8.sarge.4
ssh-argv0 uses the bash specific "${parameter##word}" parameter
expansion in order to isolate the name it was invoked with:
if [ "${0##*/}" = "ssh-argv0" ]
then
[...]
fi
Calling basename(1) like this:
ARGV0="`basename ${0}`"
if [ "${ARGV0}" = "ssh-argv0" ]
then
[...]
fi
is portable. Do it once and there's hardly a performance hit.
The system is Debian3.1, with current "apt-get upgrade" applied.
Here is a patch (diff -u):
% diff -u ssh-argv0.orig ssh-argv0
--- ssh-argv0.orig 2004-11-28 10:33:47.000000000 -0500
+++ ssh-argv0 2006-02-15 18:27:39.000000000 -0500
@@ -22,9 +22,11 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-if [ "${0##*/}" = "ssh-argv0" ]
+ARGV0="`basename ${0}`"
+
+if [ "${ARGV0}" = "ssh-argv0" ]
then
echo 'ssh-argv0: This script should not be run like this, see ssh-argv0(1) for details' 1>&2
exit 1
fi
-exec ssh "${0##*/}" "$@"
+exec ssh "${ARGV0}" "$@"
Reto Lichtensteiger
--
R A Lichtensteiger rali@tifosi.com
9. Ents and Elves dispute over title of "first-born". Elrond has Quickbeam
made into an armoire; Treebeard grinds Glorfindel into mulch.
Reply to: