Package: dash
Version: 0.5.7-4
Severity: wishlist
Tags: upstream patch

Dear Maintainer,

On a Debian system, the only way to determine the version of the dash
shell is to ask dpkg. The program itself has no way to report its
version.

It would be nice if dash provided a DASH_VERSION readonly variable. All
other shells I have installed and tested provide a way to query their
version (and to indicate that it is a particular shell, which may also
be of interest to the user):

  $ bash -c 'echo $BASH_VERSION'
  4.3.25(1)-release
  $ mksh -c 'echo $KSH_VERSION'
  @(#)MIRBSD KSH R50 2014/09/03
  $ posh -c 'echo $POSH_VERSION'
  0.12.3
  $ zsh -c 'echo $ZSH_VERSION'
  5.0.6

The following patch works for me to define DASH_VERSION as a readonly
parameter.


>From eaaba404eafd682058f0cff7566704ec5f3bc918 Mon Sep 17 00:00:00 2001
From: Mike Miller <mtmil...@debian.org>
Date: Sun, 5 Oct 2014 22:19:11 -0400
Subject: [PATCH] [VAR] Define DASH_VERSION as a readonly variable

Signed-off-by: Mike Miller <mtmil...@debian.org>
---
 src/var.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/var.c b/src/var.c
index fa24854..c0c560e 100644
--- a/src/var.c
+++ b/src/var.c
@@ -84,6 +84,8 @@ const char defifs[] = " \t\n";
 int lineno;
 char linenovar[sizeof("LINENO=")+sizeof(int)*CHAR_BIT/3+1] = "LINENO=";
 
+const char versionvar[] = "DASH_VERSION=" PACKAGE_VERSION;
+
 /* Some macros in var.h depend on the order, add new variables to the end. */
 struct var varinit[] = {
 #if ATTY
@@ -108,6 +110,7 @@ struct var varinit[] = {
        { 0,    VSTRFIXED|VTEXTFIXED|VUNSET,    "TERM\0",       0 },
        { 0,    VSTRFIXED|VTEXTFIXED|VUNSET,    "HISTSIZE\0",   sethistsize },
 #endif
+       { 0,    VSTRFIXED|VTEXTFIXED|VREADONLY, versionvar,     0 },
 };
 
 STATIC struct var *vartab[VTABSIZE];
-- 
2.1.1


-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental'), (1, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

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

Versions of packages dash depends on:
ii  debianutils  4.4
ii  dpkg         1.17.13
ii  libc6        2.19-11

dash recommends no packages.

dash suggests no packages.

-- debconf information:
* dash/sh: true


-- 
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