From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id bb947d83 for ; Sat, 14 Dec 2019 04:54:14 +0000 (UTC) Received: (qmail 3790 invoked by alias); 14 Dec 2019 04:54:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45023 Received: (qmail 22949 invoked by uid 1010); 14 Dec 2019 04:54:08 -0000 X-Qmail-Scanner-Diagnostics: from egnor-li.ofb.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25656. spamassassin: 3.4.2. Clear:RC:0(23.92.24.4):SA:0(-2.0/5.0):. Processed in 3.665257 secs); 14 Dec 2019 04:54:08 -0000 X-Envelope-From: frederik@ofb.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at ofb.net designates 23.92.24.4 as permitted sender) Date: Fri, 13 Dec 2019 20:53:30 -0800 From: frederik@ofb.net To: Zsh Workers List Subject: unreproducible bug with ${=...} Message-ID: <20191214045330.ehxgsufhhphg3twv@localhost> Reply-To: frederik@ofb.net MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Sender: Dear Zsh Workers, While working on some backup scripts I ran into what looks like an intermittent bug, which I was not able to reproduce sufficiently consistently to get a minimal test case. I'm not sure if that's helpful to report. Here is the relevant fragment: ... ssh=ssh rsync=(rsync) excludes=(/dvds /tmp .gvfs /fs) opts=(-a --partial ${=${:-"--exclude "$^excludes}} -e "$ssh") cmd=(sudo $rsync $opts $src_paths $dst_path) >&2 print -l $cmd; Basically all arguments and variables are the same between one run and the next, but sometimes it prints ... --exclude /dvds --exclude /tmp --exclude .gvfs ... (prompting a complaint from rsync), whereas usually I get the intended ... --exclude /dvds --exclude /tmp --exclude .gvfs ... The other parts of the script don't do anything weird, there is a file locking part which creates traps on INT, TERM, and EXIT after some options setting: unsetopt localtraps # so the 'trap' lasts beyond the function setopt posix_traps # so that we can trap EXIT Here is the value of IFS, I don't think I set it anywhere. $ echo -n \"$IFS\" | od -c 0000000 " \t \n \0 " 0000006 If anyone has some advice about what may be causing this, or how I can debug it or try to get a minimal test case, I'm willing to spend a little more time. I imagine it's somehow my fault, but I can't think of what could be going on here. I was running the command on an Intel Core 2 Duo laptop, with Arch (zsh 5.7.1). Thanks, Frederick P.S. I switched to using "zip" expansion, as suggested by Mikachu on IRC, which seems more elegant and doesn't use IFS: ${${:---exclude}:^^excludes}