Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Stephane Chazelas Newsgroups: gnu.bash.bug Subject: Re: Wildcard expansion can fail with nonprinting characters Date: Tue, 1 Oct 2019 07:44:20 +0100 Lines: 32 Approved: bug-bash@gnu.org Message-ID: References: <9e9454a8-35db-c426-5388-7426169c4d63@case.edu> <20191001064420.7rzjoascomqaxm53@chaz.gmail.com> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: usenet.stanford.edu 1569912269 29400 209.51.188.17 (1 Oct 2019 06:44:29 GMT) X-Complaints-To: action@cs.stanford.edu Cc: Geoff Kuenning , bug-bash@gnu.org To: Chet Ramey Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=U9URZOxybHjPxRLjUiyqvyyzgDjcCCLjdMcJ+TJH80U=; b=DLG8jKpopZsdkvYVIBYHsNGJ8IgPy/8eGwewOZe8LxuvdLuZo4CS27GsPj8Qf6NXmt L6dPTHBnGtErJCYV65swKnV7yUCnoKy1Nr8bSPMAisqWHlBxLYwrpPe/UZdnIvkFlxl1 +OHlIx24JoMXZFmtCZGKfCRp463JDuvzsa4hIRhJ2G0BLEjJ7jDrPluuBIwlBk9wGoVk zC6YaN/uIsgRfZQwyZrmOKp4Yo2ZPxCwlXhFnxUsqNunS4rQXROORWrDWIGgxHDnxTHQ E4Zrfaxn0JXU71y9ph6YrMAqFDaVwe9tyPriSoCGOExBdHwX/EPvPgryu8bIvb9/Mte5 Qf3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=U9URZOxybHjPxRLjUiyqvyyzgDjcCCLjdMcJ+TJH80U=; b=f0eIWRWr2gKPP3jiKYiogR4YprY2U4ZjEgoNSRN79msrp0NIMto/1GsTX2P22cqKAV eoNffTRk8PhUUY1RMEb1km/bCODVX6qqwWVQ96jrd4mtTK38586uAj4u1AKcq9aLWEpj AvvNrX/6C2VBm3z2UD4uxPmne8a7/p5AAogxYfdPr8En15Ajx4DwGy0dqiZQYuTDjg7S i3DsL1BUXuV0lBeHY/VzGCECrrv4/Rs3zjDAOb9bjSJamFncSlVPsmdDVLLRhzvDjEUh k27oeiAjlamoizcgejJW1ka/qvczSCXdEMTgxjDVUAjdZaGzJDKq/qgoCjmpUxO4Nnsg PN/Q== X-Gm-Message-State: APjAAAWMfKbHPG+1dCdZPdIqDoEAA6bqEw9GucZFI6FhQAqjSeqp2cF5 Kj6fy2aNqzVHkIPlaqZUq8o= X-Google-Smtp-Source: APXvYqw8BIaMHoewodInuYczxK2nRE8xBNWa3JCWwBsHG5fwEoU6tAPJFAt9+hQlhp3fL07AKgfk9A== X-Received: by 2002:a5d:6951:: with SMTP id r17mr15558190wrw.208.1569912262747; Mon, 30 Sep 2019 23:44:22 -0700 (PDT) Content-Disposition: inline In-Reply-To: <9e9454a8-35db-c426-5388-7426169c4d63@case.edu> User-Agent: NeoMutt/20171215 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20191001064420.7rzjoascomqaxm53@chaz.gmail.com> X-Mailman-Original-References: <9e9454a8-35db-c426-5388-7426169c4d63@case.edu> Xref: csiph.com gnu.bash.bug:15440 2019-09-30 15:35:21 -0400, Chet Ramey: [...] > The $'\361' is a unicode combining > character, which ends up making the entire sequence of characters an > invalid wide character string in a bunch of different locales. [...] No, $'\u0361', the unicode character 0x361 (hex) is "COMBINING DOUBLE INVERTED BREVE" (encoded as \315\241 in UTF-8) But $'\361' is byte value 0361 (octal). In UTF-8, on its own it's an invalid byte sequence. That's 2#11110001, which would be the first byte of a 4 byte-long character (of characters U+40000 to U+7FFFF). In latin1, that's ñ (LATIN SMALL LETTER N WITH TILDE). So $'foo\361bar' is not text in UTF-8, but that's an encoding issue, not a problem with combining characters. $ locale charmap UTF-8 $ printf '\u361' | od -An -to1 315 241 $ printf '\U40000' | od -An -vto1 361 200 200 200 $ printf 'foo\361bar' | iconv -f utf8 fooiconv: illegal input sequence at position 3 -- Stephane