Control: tags -1 + patch

On Wed, 02 May 2018 at 22:56:36 +0200, Lucas Nussbaum wrote:
> > shellcheck d-shlibmove
> > 
> > In d-shlibmove line 243:
> >     sed -i -e "/^.*\.la usr\/lib || true$/d" "$INSTALLFILE_DEVPKG"
> >                        ^-- SC1117: Backslash is literal in "\.". Prefer 
> > explicit escaping: "\\.".
> >                                ^-- SC1117: Backslash is literal in "\/". 
> > Prefer explicit escaping: "\\/".
(etc.)

I don't think packages should run shellcheck and similar linting tools
at build time and make warnings fatal: it's just too fragile when the
linting tool is improved to detect additional lint. Maintainers are
welcome to run these tools and use them to improve their code, but that
should be a maintainer step, not a build-time step.

However, this did at least find a real bug: d-shlibdeps didn't implement
"--" as it appeared to be intended to.

Patches attached.

Regards,
    smcv
>From 6b320e56473e7dc538fed0e80ae81ef35589cc1f Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Thu, 28 Jun 2018 12:39:04 +0100
Subject: [PATCH 2/4] d-devlibdeps: Parse -- with its conventional meaning

This appears to have always been intended, but shellcheck indicated
that the precedence was wrong, causing it to be parsed as an unknown
option instead.

Part of #897539.
---
 d-devlibdeps | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/d-devlibdeps b/d-devlibdeps
index e805491..dab5d92 100755
--- a/d-devlibdeps
+++ b/d-devlibdeps
@@ -242,11 +242,15 @@ while true; do
 		OVERRIDE[${#OVERRIDE[@]}]="$2"
 		shift 2
 		;;
+	  --)
+		shift
+		break
+		;;
 	  --*)
 		echo "$0: Unknown option $1" > /dev/stderr
 		exit 64 # EX_USAGE: command line usage error
 		;;
-	  --|*)
+	  *)
 		break
 		;;
     esac
-- 
2.18.0

>From a423c0a4346b415fd0134bb95773e2a7d3a16cb2 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Thu, 28 Jun 2018 12:23:03 +0100
Subject: [PATCH 3/4] Fix remaining shellcheck warnings

Closes: #897539
---
 d-devlibdeps | 2 +-
 d-shlibmove  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/d-devlibdeps b/d-devlibdeps
index dab5d92..9e57d96 100755
--- a/d-devlibdeps
+++ b/d-devlibdeps
@@ -294,7 +294,7 @@ outputtmp=$(mktemp)
 		fi
 	done \
 	| sed -e 's/\([a-z0-9)]\) \+\([a-z]\)/\1, \2/g' -e 's/ \+/ /g' -e 's/^ //' -e 's/ $//'
-	printf "\n"
+	printf '\n'
 ) > "$outputtmp"
 
 if grep "ERROR_DEVLIB" "$outputtmp" > /dev/null; then
diff --git a/d-shlibmove b/d-shlibmove
index 6d1909d..bbb1295 100755
--- a/d-shlibmove
+++ b/d-shlibmove
@@ -240,7 +240,7 @@ while read -r A B; do
 	echo "mv $A debian/$PKGSHL/$B" >> "$execscript"
 done < "$INSTALLFILE_SHLPKG"
 if [ "$INCLUDELA" = "no" ]; then
-	sed -i -e "/^.*\.la usr\/lib || true$/d" "$INSTALLFILE_DEVPKG"
+	sed -i -e '/^.*\.la usr\/lib || true$/d' "$INSTALLFILE_DEVPKG"
 fi
 while read -r A B; do
 	echo "$INSTALLDIR debian/$PKGDEV/$B" >> "$execscript"
@@ -248,7 +248,7 @@ while read -r A B; do
 done < "$INSTALLFILE_DEVPKG"
 
 if [ "$MULTIARCH" = "yes" ]; then
-	sed -i -e "s/usr\/lib\( || true\)\?$/usr\/lib\/$DEB_HOST_MULTIARCH\1/" "$execscript"
+	sed -i -e "s/usr\\/lib\\( || true\\)\\?$/usr\\/lib\\/$DEB_HOST_MULTIARCH\\1/" "$execscript"
 fi
 
 cat "$execscript"
@@ -267,7 +267,7 @@ fi
 if [ -n "$TRANSITIONSUFFIX" ]; then
 	check_line "$PKGSHL" "Conflicts: $SONAMEPKGNAME$SUFFIX"
 fi
-check_line "$PKGDEV" "Section: \(devel\|libdevel\)"
+check_line "$PKGDEV" 'Section: \(devel\|libdevel\)'
 if ! [ "$IGNORELIBDEP" = "yes" ]; then
 	check_line "$PKGDEV" "Depends:.*$PKGSHL"
 fi
-- 
2.18.0

Reply via email to