Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2021-11-17
10:40 • Ticket [46291ba24d] win: install: bashism in Makefile.in status still Closed... artifact: d173d13e5c user: anonymous
10:22 • Closed ticket [46291ba24d]. artifact: 9d6fdf2b92 user: jan.nijtmans
10:08
Fix [46291ba24d]: win: install: bashism in Makefile.in check-in: 7f97316fe4 user: jan.nijtmans tags: core-8-branch
08:47 • New ticket [46291ba24d] win: install: bashism in Makefile.in. artifact: ba2605f5df user: anonymous

win: install: bashism in Makefile.in

Closed / Fixed46291ba24dc85c0e66ec1771e2f39bc8ab680920Created 5 years agoUpdated 5 years ago
Descriptionplain2021-11-17 08:47:34
win/Makefile.in has bashism during install, when zipfs=no.

This can be encountered during `make install` after configuring without zipfs.

The following patch fixes it at core-8-branch, but the same fix should also be applied to main:
```
From bf4a7c32971a3a56a96298875e754ca79334dfa8 Mon Sep 17 00:00:00 2001
From: "Avi Halachmi (:avih)" <[email protected]>
Date: Wed, 17 Nov 2021 10:33:14 +0200
Subject: [PATCH] win: install: avoid bashism with zipfs=no

The expansion form *foo.{ext1,ext2} is bash-specific, and if zipfs is
disabled and the shell is not bash (e.g. on Debian when cross
compiling to windows) then this line fails.

Replace it with standard posix glob.
---
 win/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/win/Makefile.in b/win/Makefile.in
index 1e4b82299c..649f452324 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -856,7 +856,8 @@ install-libraries: libraries install-tzdata install-msgs
 	    $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)"; \
 	    done;
 	@echo "Installing package cookiejar 0.2"
-	@for j in $(ROOT_DIR)/library/cookiejar/*.{tcl,gz}; \
+	@for j in $(ROOT_DIR)/library/cookiejar/*.tcl \
+	          $(ROOT_DIR)/library/cookiejar/*.gz; \
 	    do \
 	    $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/cookiejar0.2"; \
 	    done;
-- 
2.25.1

```
Referenced by1
jan.nijtmanswiki2021-11-17 10:22:55

Fixed [here]. Thanks for the report and for the patch!

anonymousplain2021-11-17 10:40:28
Thanks.

Do note that these globs can result in an error if there are no *.tcl files (or no *.gz files), as e.g. `*.gz` "expands" to `*.gz` (i.e. unmodified) if there are no matches.

In some shells, like bash, the `nullglob` option can handle it, but that's not standardized.

A standard approach would be to check that the file exists before using it, e.g.

```
for i in path/to/*.gz; do
    [ -e "$i" ] || continue
    # do something with $i
done
```
Log in (anonymous is fine) to add a comment.