From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24408 invoked by alias); 12 Jan 2018 21:56:45 -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: 42259 Received: (qmail 23951 invoked by uid 1010); 12 Jan 2018 21:56:45 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f46.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.214.46):SA:0(-1.9/5.0):. Processed in 1.31414 secs); 12 Jan 2018 21:56:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=LrgF8Fhhg7q24NqH/ktmosnovzNIgaI7sqQGRGpZYpc=; b=cZqWdsothscwOvA9izbRDXanonF1zkB7uF1yWdyNItomQ/DQt45tZGYLJnxNdkhjYP SkaWuS9M5LaWn6l3KJ6j4aIz+sqMmbElOqAh9krlcmC1AJXF6DHq82urq1xoEbq0Y9Ds mbCZk0IW2Ecxa2WL8viT/8+cTnF4tOswGQ8/kzwxq20d76NwMtrN3oY5qfHlpiZwHPhQ +08gv4wAwZmW/wPjBs+hOWHWtuueFj9C33/d6Tgb70mNEt+tMMhoZyY5o6DBy+6gCuMA 4tXpNfjviy1pRrF7qrtHpSNvd3Zt8LMo17j+MgcZ7rYkdwIul9UJ5AWPHFQkDYWpSWZh WJrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=LrgF8Fhhg7q24NqH/ktmosnovzNIgaI7sqQGRGpZYpc=; b=NpcDfO0nfMOGr7KrbD4bBre8pyKeyK8Ojt303aq7W4zYP8YAFmClsG8mPBDsPDJH0/ VWWI0FlOr49zUDY6qq8nm+PRLOXzwps+kZU3hQA7MvzJkziDb9PLjA2W3/lbZypDGl42 NUCHF8d5yvy0+xMTJb73Ev6Qg0MUz7HYn3b5Cq6DUIQJorwX0DTdnfncrnhFZiGtrDz6 B6oQwSnQl1BkykAemVbKk597kSNks9CID9EykYjsL4SY8Bz0yLLVTC4dewWatyQQKd7t /B2DungY8pvP6Zqbtzlop7DWT5LdaR8nvP/l/TUk2gMQInwsfqXAhSehdHm1v4sSKIIg hnsw== X-Gm-Message-State: AKwxyteDkZQZbbFF5EfDQd3hOqSgk3WFPFLfOaPRktSBKku+v8F6LjCF /iBhL8sa/URznnyywrmVXM7zR/k2Ry0= X-Google-Smtp-Source: ACJfBovssUVWgB+D/+qWDLdKRXen3OlrBE4UGhbdHzx/5SabBbYZciE38Np0zD3RkvCOjeu+7VKgWw== X-Received: by 10.36.218.196 with SMTP id z187mr6097553itg.122.1515794200833; Fri, 12 Jan 2018 13:56:40 -0800 (PST) From: dana Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [BUG] Issue with pattern meta characters passed to :A Message-Id: <8FFCB628-DDE5-4FE7-B879-A6B4366B896E@dana.is> Date: Fri, 12 Jan 2018 15:56:38 -0600 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3273) Hey there. I ran into the following problem today: % print -r ${${:-a-b}:a} /Users/dana/a-b % print -r ${${:-a-b}:A} /Users/dana/a?b The ? in the second one is 0x9b (Dash). Both chabspath() (:a) and chrealpath() (:A) receive the input as = $'a\x9bb'. :a doesn't care, because all it's doing is manipulating '.' and '/' in the = string. It is a concern for :A, though, because it has to pass the string to = realpath(), and then it has to metafy() the result. There are two related issues, = then: 1. chrealpath() can't resolve paths passed into it this way if they = contain pattern meta characters (any of them, not just '-'). It calls = unmetafy(), but that doesn't help here. 2. chrealpath() metafies the result at the end, converting (e.g.) = $'.../a\x9bb' into $'.../a\x83\xbbb', which breaks the expansion even in cases = where it'd be *accidentally* correct (like the one above). (Quoting/escaping the expansion works around these. So does assigning = 'a-b' to a variable first, as long as you don't do something like ${${~str}:A}.) Simply having chrealpath() call untokenize() after unmetafy() fixes the = above test case, but then there's a new problem: ${:-a-b} and ${:-$'a\x9bb'} = are indistinguishable to the function and thus give the same result. This = would break resolution of multi-byte file names, as in ${${:-=E3=83=84}:A} = (=E3=83=84 =3D $'\u30c4' =3D $'\xe3\x83\x84'). Not sure how to fix properly. Metafication/tokenisation stuff is still = pretty confusing to me. dana