Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpAo9-0007Ft-48 for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Jan 2019 11:47:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gpAo7-0002tY-O8 for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Jan 2019 11:46:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpAo7-0002tR-E7 for pgsql-bugs@lists.postgresql.org; Thu, 31 Jan 2019 11:46:59 +0000 Received: from mail.aegee.org ([144.76.142.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpAo5-0004zB-Dg for pgsql-bugs@postgresql.org; Thu, 31 Jan 2019 11:46:58 +0000 Authentication-Results: mail.aegee.org/x0VBknAk004947; auth=pass (PLAIN) smtp.auth=didopalauzov DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aegee.org; s=k4096; t=1548935212; i=dkim+MSA-tls@aegee.org; r=y; bh=/rnRA1yhBL3VSBOL2KWHfO8rBZZvwmqFxJ3Cw/WFQlg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=ZbEhKBPwoRKAHrY355fnfcsRGGWRzRfPTy3fY3QQqW2U7BvvGMO1xoknyY+scU4No AKOs0SP9YOV614i04ooMl8Emp8Xyxwi5shdlvITqDU8SW/dmUMinUdQRoC7YtKhAbu pbbP/3iWKwOjFw/tyMvecxG+89y0IkIEoO8AkXBPxUzd3+wNy6BSan2sPQnA0W4mf7 WsXseSwgorPd0j1Kt5InA7M6C7ux8ss7Nj/jedXd6HxJn3lhwFX3pKt33QgJeCcDOq GCfRfTUgww2DoPysFKDy6eSE3QucLSFw5FF3cipj51AxJZ30TmHjGo3DfnTi2VpxEZ wLs9UK8ifyRPpd/0sVPUWRrQ8At6BibRwkChGV0p/x8kuoxygq8Vn/+XAO187lEM6y pntHmkUcVFjBUPqVlLN0xpgZR4vJ9jFDhYfB2mxGQJFxaX2RgyISjAWiXzRF6Dni9s /q3mspuF3wtJHndAC/xpdgON9Rhsrqtm6HPSGwE0WZRwumquCN9LWHHN7KPuyxtGUA l9bNQXlnmswWoYI8Z7Sx3Qe08jSSjivSNEjy4Py90OSZIZ65JEwT3JfOUZlPjJKOpX xEG1DeiSP8vwztmayp7sElVKhEWrPXXYILhuMckt6Vkf9kVI6/oZfNK21Qg7rs78Mj jXH47aG5uMd3H/IwiifYlhqY= Authentication-Results: mail.aegee.org/x0VBknAk004947; dkim=none Received: from Tylan (85.234.198.115.static.edpnet.net [85.234.198.115] (may be forged)) (authenticated bits=0) by mail.aegee.org (8.15.2/8.15.2) with ESMTPSA id x0VBknAk004947 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 31 Jan 2019 11:46:51 GMT Message-ID: Subject: Re: psql and readline comments From: =?UTF-8?Q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD_?= =?UTF-8?Q?=D0=9F=D0=B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=D0=B2?= To: Bruce Momjian , Andrew Gierth Cc: Peter Eisentraut , Alvaro Herrera , Tom Lane , pgsql-bugs@postgresql.org Date: Thu, 31 Jan 2019 11:46:49 +0000 In-Reply-To: <20190129230214.GD25187@momjian.us> References: <201901141559.ne4yhv2nwsl5@alvherre.pgsql> <82eab8ea-5d9d-efab-dcc8-d7713d2b0645@2ndquadrant.com> <20190126001801.GL13803@momjian.us> <87womsjbpq.fsf@news-spur.riddles.org.uk> <20190128191731.GC26761@momjian.us> <87bm40hyg1.fsf@news-spur.riddles.org.uk> <20190129230214.GD25187@momjian.us> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.31.90 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.101.1 at mail.aegee.org X-Virus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, my reading on the correspondence so far is, that: - https://www.postgresql.org/docs/current/install-requirements.html states, that libedit is compatible to libreadline, - libreadline exports the symbol rl_variable_value(), while libedit does not - both libraries export rl_variable_bind() - for licensing reasons, sometimes psql is configured and built with support for libedit, but at runtime libreadline is plugged in the dynamic linker Corollary: libreadline and libedit are not 1:1 interchangable. libreadline is compatible to libedit, but not vise- versa. What speaks against updating the documentation, stating that if psql is configured and build against libreadline, at runtime it cannot use libedit? There’s in anyway no need for such exaggerated cases. And also clarify, whether building/configuring against libedit but running against libreadline is supported. Second approach: if psql was build and configured against libedit, then set comment-begin unconditionally (or do not set it). Problematic is anyway the case, when psql is build against libreadline, but executed against libedit. Third approach: call something like: char*(psql_rl_variable_value)(const char*) = dlsym(RTLD_DEFAULT, "rl_variable_value"); //if psql_rl_variable_value is NULL, then libedit is used at runtime and not libreadline if (!psql_rl_variable_value || !strcmp("#", psql_rl_variable_value("comment-begin"))) // set comment-begin if libedit is used, or .libinput does not override the default for "comment-begin" rl_variable_bind("comment-begin", "--"); Regards Дилян On Tue, 2019-01-29 at 18:02 -0500, Bruce Momjian wrote: > On Tue, Jan 29, 2019 at 04:59:40AM +0000, Andrew Gierth wrote: > > > > > > > "Bruce" == Bruce Momjian writes: > > > > Bruce> Uh, bind as a key? Does the patch have any effect then? > > > > As I said, libedit does not bind M-# by default, and has no equivalent > > to readline's comment-begin variable. I have no idea what the patch > > would do when linked against libedit without actually trying it out > > (which I have not done). > > > > Bruce> If not, maybe we should just do this for libreadline. > > > > Bear in mind that for licensing reasons, some package builds build psql > > against libedit but then wedge readline in at runtime using LD_PRELOAD. > > So doing things differently at compile time based on whether it's > > libedit or readline will not work well with that. > > Seems like adding this would be more trouble than it is worth then. >