From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-x235.google.com (mail-wg0-x235.google.com [IPv6:2a00:1450:400c:c00::235]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 484757AF06 for ; Fri, 17 Apr 2015 14:35:14 -0700 (PDT) Received: by wgsk9 with SMTP id k9so125647359wgs.3 for ; Fri, 17 Apr 2015 14:34:09 -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=q/W23Uz1rmGaN4oPWXkwPvgpT9bG9FcdwrE5qJlemjU=; b=RgwYwSTmRmbzEIYGs1/tnTOSaVAwr8iPD85zQmpJEe4lPVeCGa8IGLb25OyWsxs00p yKthQRg5wIUHa20S5KYuFe7nOnPc+MO2EDQ2sb7co7cRZp4hwkURM1o1F5MlZ1BvfX8a QD49f9KwU1+Bi2AiWql1MG4y61OdHL6fmDqGKEejcc4gCVsn4+7lChk2V/+j/aRLJUX6 PdqpQlxfmiNsN6Ippvb3qKUFPuYSsgOBUN/YZEXsfVMzB3QaVRu5xN4kXCDGTKw0XyLE 9N5A3VnJ70zgHq7NVPxUX8kyrv3+Fb1vPomczCq7T4ltrDmuS8UE5Mpn0IOLXEbOBRpr LvyA== X-Received: by 10.194.9.98 with SMTP id y2mr9744126wja.85.1429306449181; Fri, 17 Apr 2015 14:34:09 -0700 (PDT) Received: from toaster.adamthompson.me.uk (toaster.adamthompson.me.uk. [2001:8b0:1142:9042::2]) by mx.google.com with ESMTPSA id m1sm4263014wiw.7.2015.04.17.14.34.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 14:34:08 -0700 (PDT) Date: Fri, 17 Apr 2015 22:34:05 +0100 From: Adam Thompson To: Karl Dahlke Message-ID: <20150417213405.GE5949@toaster.adamthompson.me.uk> References: <20150316174053.eklhad@comcast.net> <20150417125002.GA14517@toaster.adamthompson.me.uk> <20150317140113.eklhad@comcast.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EgVrEAR5UttbsTXg" Content-Disposition: inline In-Reply-To: <20150317140113.eklhad@comcast.net> 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 21:35:15 -0000 --EgVrEAR5UttbsTXg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 17, 2015 at 02:01:13PM -0400, Karl Dahlke wrote: > I pulled the latest, withthe quick check removed, > and I don't like it, or I'm just not use to it. > This is a change in the user interface, > and if we all agree it should be made, then I also need to change the doc= umentation. > I designed it so that it would not be hard or complicated > or confusing to edit files, like a'b or a(b or a|b or a[b, > and now these all produce errors, where they didn't before. > Errors because they all run through wordexp, and they didn't before. >=20 > e a(b > unexpected error while evaluating the shell pattern >=20 > What is the user suppose to do with that?? >=20 > edbrowse use to run filenames through wordexp when > it is "reasonable" to do so, as per my check, and as per the following se= ction > from my documentation. >=20 > ------------------------------------------------------------ >=20 > Whenever a file is read from or written to disk, $var, in the filename, > is replaced with the corresponding environment variable. > Thus you can edit your address book at any time via `e $adbook', > provided $adbook has been set in your environment. > Also, a leading ~/ is replaced with $HOME/, > making it easy to edit files in your home directory such as ~/.profile. >=20 > Shell meta characters are also expanded, provided the result is one file = name. > You can read or write a file by typing a minimal portion of its name. > e work/foo* to get work/foobar. >=20 > Expansion is performed by wordexp(3), simulating a posix shell. > Unfortunately this has certain side effects. > Meta characters such as | & ' < ; etc will derail the expansion, > unless escaped by a backslash. This is confusing at first, > so think of it this way: "If I want to expand a file name using variables= or > wild cards, i.e. a string containing $ [] * ? > or a leading ~/, I have to type it in as though I were typing at the shel= l." > An example might be $phones/at\&t. Even spaces must be escaped with backs= lash > or put in quotes. This complexity only occurs > if you are accessing environment variables or globbing. >=20 > ------------------------------------------------------------ >=20 > So the quick check was there for a reason, > and I don't think it was particularly buggy. > I don't want us to undo each other's work, that isn't productive, > so we should decide if we want this feature, yes or no, > and if we do put it back in, > and if we don't then I need to change the documentation. > I like the feature, because I don't want to have to escape things with ba= ckslashes all the time, > except on that rare occasion that I am invoking wordexp and need to escap= e things for wordexp. > Another option is to forget wordexp and go back to the code > that I wrote 5 years ago, my own variable expansion and globbing, > which worked, and didn't have any of this '"()|; confusion around it. > It did what you want and didn't have any side effects. > Maybe I should have left well enough alone. > But we are where we are, and from here I guess I'd like to put my quick c= heck > back in, perhaps modified if you think it has some bugs. >=20 > 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 > Karl Dahlke > _______________________________________________ > Edbrowse-dev mailing list > Edbrowse-dev@lists.the-brannons.com It fixed my test case when I tested it, which appears to be *another* bug which looked similar to this one. With it as it stands now, typing: e a\\b When you've got a directory named 'a\b' in the current directory allows you= to edit the correct thing (i.e. typing 'f' yields 'a\b') but the files aren't visible in this case. This isn't an escaping bug in wordexp as otherwise the double '\' would sti= ll be there. I suspect we're double expanding or something somewhere, I need to check. As for the quick check, there are corner cases it misses, like the ~username syntax which is surprisingly useful once you get used to= it. I think the better way round this would be to reverse the leading ` since readline completion doesn't do wordexp-safe file names at the moment = (and making it do that is difficult). This would work for me as a user since it'd mean "treat this filename specially". That'd get rid of all the random confusion and need to escape things, apart from in the very rare cases that you genuinely want an ` at the start= of your file name. Cheers, Adam. --EgVrEAR5UttbsTXg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVMXxNAAoJELZ22lNQBzHO1Z4IAIDJFRcN2C/9XPTCaSR6t13o BQem2Ayu4efVRoYZVEjdP8X9jei/J6fs4iVDqciGcaocKEiou4iCpLalbHvoIA7D TjbtdB9peU5dYZ20sV1RWFoWdhY7tpWF1Zbbd65qfXeOQ8Vk9mq2BviRMwY35QSd Lck7bYtSGmybq7XggumnYGevGvk2qXdvj1WWf8TK/KLhLLpzIjPzEdcJqt1r2xPr ZPdPLQ4uTcmMghMd15FjtJ+AVdFn72+RnSYbvlCQ5Wdx50lWnwQYqMufzFfrrxZi 6+aWwX/AxBCFvcfIS5XlmN5LBVUtDMmMGTb0vA1KGRdw3EnqrLBILWrLINRphIE= =XNh9 -----END PGP SIGNATURE----- --EgVrEAR5UttbsTXg--