From unknown Tue Jun 17 22:30:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12724: ldap.el Problem and Solution Resent-From: Noah Lavine Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Oct 2012 18:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12724 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 12724@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.135110374131328 (code B ref -1); Wed, 24 Oct 2012 18:36:02 +0000 Received: (at submit) by debbugs.gnu.org; 24 Oct 2012 18:35:41 +0000 Received: from localhost ([127.0.0.1]:59978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR5no-00089F-ID for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:35:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41765) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR5nl-000892-G6 for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:35:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5lk-0008S7-H3 for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:33:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_MANY_HDRS_LCASE autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5lk-0008S3-Du for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:33:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5le-0005fQ-Gd for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5la-0008QN-EF for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:26 -0400 Received: from relais.videotron.ca ([24.201.245.36]:56721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5la-0008QD-Bi for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:22 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from ceviche.home ([96.21.127.30]) by VL-VM-MR004.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MCE008T7U7JJ880@VL-VM-MR004.ip.videotron.ca> for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:20 -0400 (EDT) Received: by ceviche.home (Postfix, from userid 20848) id BB39B661F0; Wed, 24 Oct 2012 14:33:06 -0400 (EDT) From: Noah Lavine Message-id: Date: Wed, 24 Oct 2012 14:33:06 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) Hello, I recently hit a problem in which ldap-search (in ldap.el) would return a list of records where the first record would always be nil. As far as I can tell, the rest of the list was correct; it just had an extra nil in the beginning. After some debugging, I think the issue is that my ldapsearch program (from OpenLDAP) doesn't quite use the output format ldap.el expects. The expected format is dn: .......... : : .... more attributes here ...... This is the ldif format, which seems to be standardized. But tragically, my ldapsearch program prints a header, which makes the results look like this: version: 1 dn: ......... : .... more attributes ..... This confuses the ldap.el parsing. I can tell this is the problem because when I step through in the debugger, the "dn" variable is set to "version: 1", instead of the obviously correct value. Then when it attempts to parse its results it finds an empty record, and so pushes 'nil onto its results list, which is what causes the problem. The solution is to insert this after line 579 of ldap.el: (if (looking-at "version:") (forward-line 1)) I have tested this, and it seems to work for me. The other option is to make the ldapsearch program not print its version header, but looking at its man page, I don't see a way to do that. If this solution doesn't seem good, I am happy to try a different approach, but it seems like the easiest solution to me. I have already signed copyright papers, although for a change as small as this they might not even be needed. Thanks, Noah Lavine From unknown Tue Jun 17 22:30:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12724: ldap.el Problem and Solution Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Oct 2012 20:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12724 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Noah Lavine Cc: 12724@debbugs.gnu.org Received: via spool by 12724-submit@debbugs.gnu.org id=B12724.13511113299954 (code B ref 12724); Wed, 24 Oct 2012 20:43:01 +0000 Received: (at 12724) by debbugs.gnu.org; 24 Oct 2012 20:42:09 +0000 Received: from localhost ([127.0.0.1]:60051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR7mC-0002aU-GE for submit@debbugs.gnu.org; Wed, 24 Oct 2012 16:42:09 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:16005) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR7m8-0002Zv-W1 for 12724@debbugs.gnu.org; Wed, 24 Oct 2012 16:42:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu0/O+LFW/2dsb2JhbABEsEiDSYEIghYBBVYjEAs0EhQYDSQuh3O6CYsSCoUoA6MzgViDBYE7 X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="202651968" Received: from 206-248-177-86.dsl.teksavvy.com (HELO pastel.home) ([206.248.177.86]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 24 Oct 2012 16:39:59 -0400 Received: by pastel.home (Postfix, from userid 20848) id 2BB6C58CA3; Wed, 24 Oct 2012 16:39:59 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 24 Oct 2012 16:39:58 -0400 In-Reply-To: (Noah Lavine's message of "Wed, 24 Oct 2012 14:33:06 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > (if (looking-at "version:") > (forward-line 1)) Can you confirm the patch below works? Stefan === modified file 'lisp/net/ldap.el' --- lisp/net/ldap.el 2012-07-11 23:13:41 +0000 +++ lisp/net/ldap.el 2012-10-24 20:39:11 +0000 @@ -604,6 +604,7 @@ ;; Skip error message when retrieving attribute list (if (looking-at "Size limit exceeded") (forward-line 1)) + (if (looking-at "version:") (forward-line 1)) ;bug#12724. (while (progn (skip-chars-forward " \t\n") (not (eobp))) From unknown Tue Jun 17 22:30:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12724: ldap.el Problem and Solution Resent-From: Noah Lavine Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Oct 2012 21:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12724 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 12724@debbugs.gnu.org Received: via spool by 12724-submit@debbugs.gnu.org id=B12724.135111505215686 (code B ref 12724); Wed, 24 Oct 2012 21:45:01 +0000 Received: (at 12724) by debbugs.gnu.org; 24 Oct 2012 21:44:12 +0000 Received: from localhost ([127.0.0.1]:60116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR8kG-00044w-9z for submit@debbugs.gnu.org; Wed, 24 Oct 2012 17:44:12 -0400 Received: from mail-oa0-f44.google.com ([209.85.219.44]:57947) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR8kE-00044k-TB for 12724@debbugs.gnu.org; Wed, 24 Oct 2012 17:44:11 -0400 Received: by mail-oa0-f44.google.com with SMTP id n5so912649oag.3 for <12724@debbugs.gnu.org>; Wed, 24 Oct 2012 14:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=bZ1Y4OhMsylIJZwsT0yfMWeQMOAmIPSPG0JvvIFmo8M=; b=atdyBYUPW54J8HONnguEiSiE6n8wbeAkYyCllulfnoin9VksF3qYLi3TJBp18HTY4G 8+7c/F9X6qtLBVb99aMidTTtsPVMFGPI1yPNH93G782tAsb2Pjbcezt74tNEIJ7Nxf9X hQyLV9szmYac4lwtxJOYvvgndForOBSob9WExsZKW9chP/IsG0A3ruzkm9Mj4BQp1+R4 E46ONIjdi8PYz1xeyeBsLS+sMjpEp8iVTMijnu5BCbct91C41uZe4j/RgWuVMM668Ex+ 2MW/RZi/Kt4/aeZVwWT6RizTYn4+XvLKzULvUMTHTWElCSnuvHkFuHM0iMMFOeEJMobw pcHg== MIME-Version: 1.0 Received: by 10.60.14.200 with SMTP id r8mr9030680oec.45.1351114924297; Wed, 24 Oct 2012 14:42:04 -0700 (PDT) Received: by 10.76.120.236 with HTTP; Wed, 24 Oct 2012 14:42:04 -0700 (PDT) In-Reply-To: References: Date: Wed, 24 Oct 2012 17:42:04 -0400 X-Google-Sender-Auth: 9NcL8mlsj5mZZljAuZLKGJ8GwTc Message-ID: From: Noah Lavine Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Score: 0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.4 (/) Yes, that works. Thanks a lot for such a quick response, Noah On Wed, Oct 24, 2012 at 4:39 PM, Stefan Monnier wrote: >> (if (looking-at "version:") >> (forward-line 1)) > > Can you confirm the patch below works? > > > Stefan > > > === modified file 'lisp/net/ldap.el' > --- lisp/net/ldap.el 2012-07-11 23:13:41 +0000 > +++ lisp/net/ldap.el 2012-10-24 20:39:11 +0000 > @@ -604,6 +604,7 @@ > ;; Skip error message when retrieving attribute list > (if (looking-at "Size limit exceeded") > (forward-line 1)) > + (if (looking-at "version:") (forward-line 1)) ;bug#12724. > (while (progn > (skip-chars-forward " \t\n") > (not (eobp))) > From unknown Tue Jun 17 22:30:11 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Noah Lavine Subject: bug#12724: closed (Re: bug#12724: ldap.el Problem and Solution) Message-ID: References: X-Gnu-PR-Message: they-closed 12724 X-Gnu-PR-Package: emacs Reply-To: 12724@debbugs.gnu.org Date: Thu, 25 Oct 2012 12:44:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1351169042-12612-1" This is a multi-part message in MIME format... ------------=_1351169042-12612-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #12724: ldap.el Problem and Solution which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 12724@debbugs.gnu.org. --=20 12724: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D12724 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1351169042-12612-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 12724-done) by debbugs.gnu.org; 25 Oct 2012 12:43:55 +0000 Received: from localhost ([127.0.0.1]:60870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRMmx-0003H1-ED for submit@debbugs.gnu.org; Thu, 25 Oct 2012 08:43:55 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:13483) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TRMmv-0003Go-1z for 12724-done@debbugs.gnu.org; Thu, 25 Oct 2012 08:43:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu0/O+LFW/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLNBIUGA0kLoduBboJkEQDozOBWIMF X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="202813843" Received: from 206-248-177-86.dsl.teksavvy.com (HELO pastel.home) ([206.248.177.86]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Oct 2012 08:41:44 -0400 Received: by pastel.home (Postfix, from userid 20848) id F1FD4593D3; Thu, 25 Oct 2012 08:41:43 -0400 (EDT) From: Stefan Monnier To: Noah Lavine Subject: Re: bug#12724: ldap.el Problem and Solution Message-ID: References: Date: Thu, 25 Oct 2012 08:41:43 -0400 In-Reply-To: (Noah Lavine's message of "Wed, 24 Oct 2012 17:42:04 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 12724-done Cc: 12724-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) > Yes, that works. Thank you, installed, Stefan ------------=_1351169042-12612-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 24 Oct 2012 18:35:41 +0000 Received: from localhost ([127.0.0.1]:59978 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR5no-00089F-ID for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:35:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41765) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TR5nl-000892-G6 for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:35:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5lk-0008S7-H3 for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:33:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_MANY_HDRS_LCASE autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:43854) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5lk-0008S3-Du for submit@debbugs.gnu.org; Wed, 24 Oct 2012 14:33:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5le-0005fQ-Gd for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5la-0008QN-EF for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:26 -0400 Received: from relais.videotron.ca ([24.201.245.36]:56721) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5la-0008QD-Bi for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:22 -0400 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from ceviche.home ([96.21.127.30]) by VL-VM-MR004.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0MCE008T7U7JJ880@VL-VM-MR004.ip.videotron.ca> for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2012 14:33:20 -0400 (EDT) Received: by ceviche.home (Postfix, from userid 20848) id BB39B661F0; Wed, 24 Oct 2012 14:33:06 -0400 (EDT) From: Noah Lavine To: bug-gnu-emacs@gnu.org Subject: ldap.el Problem and Solution Message-id: Date: Wed, 24 Oct 2012 14:33:06 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) Hello, I recently hit a problem in which ldap-search (in ldap.el) would return a list of records where the first record would always be nil. As far as I can tell, the rest of the list was correct; it just had an extra nil in the beginning. After some debugging, I think the issue is that my ldapsearch program (from OpenLDAP) doesn't quite use the output format ldap.el expects. The expected format is dn: .......... : : .... more attributes here ...... This is the ldif format, which seems to be standardized. But tragically, my ldapsearch program prints a header, which makes the results look like this: version: 1 dn: ......... : .... more attributes ..... This confuses the ldap.el parsing. I can tell this is the problem because when I step through in the debugger, the "dn" variable is set to "version: 1", instead of the obviously correct value. Then when it attempts to parse its results it finds an empty record, and so pushes 'nil onto its results list, which is what causes the problem. The solution is to insert this after line 579 of ldap.el: (if (looking-at "version:") (forward-line 1)) I have tested this, and it seems to work for me. The other option is to make the ldapsearch program not print its version header, but looking at its man page, I don't see a way to do that. If this solution doesn't seem good, I am happy to try a different approach, but it seems like the easiest solution to me. I have already signed copyright papers, although for a change as small as this they might not even be needed. Thanks, Noah Lavine ------------=_1351169042-12612-1--