From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 67D217AF0A for ; Fri, 17 Apr 2015 15:29:50 -0700 (PDT) Received: by wgyo15 with SMTP id o15so126890781wgy.2 for ; Fri, 17 Apr 2015 15:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=W/5luUwpda1Wt52dHzyHC+I4k6M2bDpLHWvm/hh2M5o=; b=f3XGx8xh5Dvi+lfORH7DlT4Y6t+hhHmchXTs5pe4VlioZiYtX+FiKyG2FdUqGXpg6s fOs91/UjVTkwbqN88nWP8hEQyMWovtEzPS1zjtXGBQ7jAM7sl0NQPHVgO98f/3df/hdI 0xGyo8VJ98U0zEM5ryw4iJNKw+2kDiGrETVKmbj0aUB7EpZBN45VAGsBlfqLv9c9Zoz5 CDtA7bH5ylwCZ2CIKZOych/KJjdNrsbjw50hJ3teyAtXLX/VTi5Vcb9oSwO7siOfQoAL IGeOljMoIvNn1pmozgdml8N2jcgRWJaCbeZQkTHn/TmbqNY7OAh324uDHXFFsvM2uRVl efHQ== X-Received: by 10.180.90.210 with SMTP id by18mr1820570wib.0.1429309725165; Fri, 17 Apr 2015 15:28:45 -0700 (PDT) Received: from toaster.adamthompson.me.uk (toaster.adamthompson.me.uk. [2001:8b0:1142:9042::2]) by mx.google.com with ESMTPSA id cf12sm16411819wjb.10.2015.04.17.15.28.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 15:28:44 -0700 (PDT) Date: Fri, 17 Apr 2015 23:28:42 +0100 From: Adam Thompson To: Karl Dahlke Message-ID: <20150417222842.GG5949@toaster.adamthompson.me.uk> References: <20150316174053.eklhad@comcast.net> <20150417125002.GA14517@toaster.adamthompson.me.uk> <20150317140113.eklhad@comcast.net> <20150417213405.GE5949@toaster.adamthompson.me.uk> <20150417215826.GF5949@toaster.adamthompson.me.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HB4mHL4PVvkpZAgW" Content-Disposition: inline In-Reply-To: <20150417215826.GF5949@toaster.adamthompson.me.uk> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Edbrowse-dev@lists.the-brannons.com Subject: Re: [Edbrowse-dev] wordexp again X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 22:29:50 -0000 --HB4mHL4PVvkpZAgW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 17, 2015 at 10:58:26PM +0100, Adam Thompson wrote: > On Fri, Apr 17, 2015 at 10:34:05PM +0100, Adam Thompson wrote: > > > By the way, removing quick check had nothing to do with the bug > > > that I posted at the top of this thread. > > > You stil can't edit a directory with backslash in the name, > > > and I think that is a bug in wordexp that we can't get around. > > > That's maybe another reason to go back to my home grown code. >=20 > No, it's a bug in our code. I've checked and we've got a couple of intere= sting > things happening. With wordexp enabled, we're duble expanding the filenam= e, > once before we pass it to sortedDirList, and once in nextScanFile. > Without wordexp expansion, we don't expand the file name before we get to > nextScanFile, but then the single \ is swallowed by wordexp so the glob i= s incorrect. > I should've spotted this when we first switched to using wordexp because = the > call in nextScanFile really should be to glob rather than wordexp. > Better still, I think we just shouldn't have switched nextScanFile to wor= dexp > since we just want a directory listing in this case. In the case of sortedDirList we should be using scandir with the alphasort function as a comparison function (then loading into your line map probably= ), for the NextScanFile function (used in fetchmail.c I think) we probably want to go back to readdir. I'm happy to put together a fix for this tomorrow. > I've also tried out the inverted ` character and that seems to make much = more > sense in terms of usable behaviour. Any thoughts? I think this makes more sense to me since I don't have to be trying to work out what and when I need to escape things, i.e. with the "quick check" if I use ~/ then I have to shell escape everything, or if I use $ then I have to escape everything. Whereas with the ` character acting to *enable* expansion, then if I specify ` at the start of the filename then I know I need to shell escape everything because I'm getting wordexp. The change I made also had a \ escape for ` in the rare case that the leadi= ng ` is required. If you're happy with this then I'll test and push this change. Cheers, Adam. --HB4mHL4PVvkpZAgW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVMYkaAAoJELZ22lNQBzHOm9QH+wcgpjgZ7sqBM/Fad8HTyzK2 zV4/VP2IIylUurQxZkRXeqKszbqZqu6c5U0v885FENuBjYJDTKL6SXdkxL6lY9OR nu+SYF0k7zfp2Tp7LG0yApxn8z21ykPPOmyNcYJr2l6za8AtCpgIic5Po9owCJLL gO1LOQI+Z3/vc+2ydmzRxIqhNkYmCCAUzD+n38iCIons9MUPnXOJHOTJvClR/lBK XMbx5OoLalBLBPMEiEOYpYdB0VMDkhzQqk9Ry1NnUvUEkDraCOoqMG6oiHQH/YlF Evofjf+cBRat9XkCL5588yJ6WpArpj87N6m+P5wzKKJ415JEa9xlj9/Nbj4Xrj0= =vefh -----END PGP SIGNATURE----- --HB4mHL4PVvkpZAgW--