
fschlich at ZEDAT
Mar 21, 2012, 1:17 PM
Post #1 of 2
(350 views)
Permalink
|
|
[PATCH] typo and bashisms
|
|
Hi, there are two small things that I noticed in current vpnc, and for which I wanted to suggest a patch. The first is a typo in a warning message in vpnc.c; the second is that mk-version is a bash script pretending to be runnable by plain /bin/sh. On Debian systems, where /bin/sh is linked to dash by default, this leads to the warning mk-version: 6: mk-version: Syntax error: "(" unexpected and, more annoyingly, an empty VERSION string (-DVERSION=\"\"). checkbashisms reports numerous issues: possible bashism in mk-version line 6 ('function' is useless): function git_svn_version () possible bashism in mk-version line 17 (should be VAR="${VAR}foo"): svn_url_pattern+="\\|$value" possible bashism in mk-version line 29 (${foo:3[:1]}): svn_log=($(git log --first-parent -1 \ --grep="^git-svn-id: \(${svn_url_pattern:2}\)@" 2>/dev/null)) possible bashism in mk-version line 32 (bash arrays, ${name[0|*|@]}): svn_commit=${svn_log[1]} possible bashism in mk-version line 33 (${parm/?/pat[/str]}): if [ ${#svn_commit} -ne 40 -o -n "${svn_commit//[0-9a-f]/}" ]; then possible bashism in mk-version line 38 (bash arrays, ${name[0|*|@]}): svn_ver=${svn_log[ ${#svn_log[@]} - 2 ]} possible bashism in mk-version line 40 (${parm/?/pat[/str]}): if [ -z "${#svn_ver}" -o -n "${svn_ver//[0-9]/}" ]; then possible bashism in mk-version line 59 ('command' with option other than -p): if command -v svnversion >/dev/null; then possible bashism in mk-version line 64 ('command' with option other than -p): elif command -v git >/dev/null; then But the easiest fix is surely to mark and call it as the bash script that it is. So here's the patch: diff --git a/Makefile b/Makefile index e0f8148..a725aea 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ OBJS = $(addsuffix .o,$(basename $(SRCS))) CRYPTO_OBJS = $(addsuffix .o,$(basename $(CRYPTO_SRCS))) BINOBJS = $(addsuffix .o,$(BINS)) BINSRCS = $(addsuffix .c,$(BINS)) -VERSION := $(shell sh mk-version) +VERSION := $(shell bash mk-version) RELEASE_VERSION := $(shell cat VERSION) CC=gcc diff --git a/mk-version b/mk-version index 68552e7..8225e41 100755 --- a/mk-version +++ b/mk-version @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # print vpnc version from file VERSION, appending the string printed # by svnversion(1) if appropriate diff --git a/vpnc.c b/vpnc.c index 7ee0b0f..91cf6d6 100644 --- a/vpnc.c +++ b/vpnc.c @@ -2739,7 +2739,7 @@ static void do_phase2_qm(struct sa_block *s) seen_auth, NULL, 0)->name)); if (s->ipsec.cry_algo == GCRY_CIPHER_DES && !opt_1des) { error(1, 0, "peer selected (single) DES as \"encrytion\" method.\n" - "This algorithm is considered to weak today\n" + "This algorithm is considered too weak today\n" "If your vpn concentrator admin still insists on using DES\n" "use the \"--enable-1des\" option.\n"); } else if (s->ipsec.cry_algo == GCRY_CIPHER_NONE && !opt_no_encryption) { Florian _______________________________________________ vpnc-devel mailing list vpnc-devel [at] unix-ag https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel http://www.unix-ag.uni-kl.de/~massar/vpnc/
|