File: Remove-small-bashism-from-Makefile.patch

package info (click to toggle)
librdkafka 2.11.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,536 kB
  • sloc: ansic: 145,376; cpp: 13,010; sh: 3,928; python: 2,470; makefile: 580; java: 181
file content (39 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From: Faidon Liambotis <paravoid@debian.org>
Date: Thu, 12 Jan 2023 03:50:36 +0200
Subject: Remove small bashism from Makefile

The LICENSES.txt target makes a shell for loop, in which it tries to
evaluate the wildcard "LICENSE.*[^~]".

[^] is a bashism, and fails when /bin/sh is not bash (i.e. every
Debian-based system by default):

$ /bin/bash -c "ls LICENSE.*[^~]"
LICENSE.cjson	LICENSE.fnv1a	      LICENSE.lz4      LICENSE.pycrc  LICENSE.regexp  LICENSE.tinycthread
LICENSE.crc32c	LICENSE.hdrhistogram  LICENSE.murmur2  LICENSE.queue  LICENSE.snappy  LICENSE.wingetopt

$ /bin/sh -c "ls LICENSE.*[^~]"
ls: cannot access 'LICENSE.*[^~]': No such file or directory

The equivalent POSIX way to do this is to use [!].

Tested with bash, dash and posh.

Forwarded: https://github.com/confluentinc/librdkafka/pull/4147
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6df5a3a..ce2e11e 100755
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@ rpm: distclean
 	$(MAKE) -C packaging/rpm
 
 LICENSES.txt: .PHONY
-	@(for i in LICENSE LICENSE.*[^~] ; do (echo "$$i" ; echo "--------------------------------------------------------------" ; cat $$i ; echo "" ; echo "") ; done) > $@.tmp
+	@(for i in LICENSE LICENSE.*[!~] ; do (echo "$$i" ; echo "--------------------------------------------------------------" ; cat $$i ; echo "" ; echo "") ; done) > $@.tmp
 	@cmp $@ $@.tmp || mv -f $@.tmp $@ ; rm -f $@.tmp