[Pkg-openldap-devel] Bug#530519: Bug#530519: /usr/bin/ldapsearch: ldap-utils: ldapsearch always cut output into 76-character length lines

Russ Allbery rra at debian.org
Mon May 25 20:14:29 UTC 2009


spg <bugreporter at udmvt.ru> writes:

> This does not depend on tty width.
> Also no piece of code checks to see if output is a tty.
> Output example:
> mail:< file:///tmp/ldapsearch-mail-gA0v8v
> msExchHomeServerName:< file:///tmp/ldapsearch-msExchHomeServerName-y5RfdB
> msExchMailboxSecurityDescriptor:< file:///tmp/ldapsearch-msExchMailboxSecurit
>  yDescriptor-y7G0hG
> msExchUserAccountControl:< file:///tmp/ldapsearch-msExchUserAccountControl-K9
>  yMmL
> msExchMailboxGuid:< file:///tmp/ldapsearch-msExchMailboxGuid-eHEzrQ
> End of example.

I think it's fairly unlikely that upstream is going to change this, and
I don't think this is a place where Debian should diverge from upstream.
You could try to talk upstream into it, but I suspect that always
folding at a "safe" column width is intentional.  It does make it less
likely that LDIF will be mangled when cut and paste or sent via e-mail.

> That happens even if output is a pipe to a script and that results in
> mentioned files being not found by that script.

I can predict what upstream's response would be to this: LDIF may be
folded; that's part of the specification of LDIF.  Anything that
consumes LDIF has to deal with folded lines.

I'm sympathetic to not wanting scripts to have to deal with full LDIF,
but I suspect you'll find it easiest to just write a simple unfolding
script and through that in the pipeline after ldapsearch.

> NB: I use xterm and my terminal have a line width of 125

Yeah, one can tell from your e-mail.  :)

> The manpage says " -L Search results are display in LDAP Data
> Interchange Format detailed in ldif(5)."  That makes the reader think,
> that LDIF output is switched by -L switch.  It would be better to
> explicitly express, that output is ALWAYS in LDIF format and that fact
> is not related to -L option, since only the version and other details
> of LDIF is affected by -L.

The output without -L isn't actually in LDIF, just in something that
looks very similar to LDIF (which the man page calls extended LDIF).
Here's the full paragraph from the current man page:

   -L     Search results are  display  in  LDAP  Data  Interchange  Format
          detailed  in  ldif(5).   A  single  -L  restricts  the output to
          LDIFv1.  A second -L disables comments.   A  third  -L  disables
          printing of the LDIF version.  The default is to use an extended
          version of LDIF.

Note the last sentence.

Here are the differences between no option and -L, for example:

--- foo 2009-05-25 13:09:57.000000000 -0700
+++ foo.1       2009-05-25 13:09:51.000000000 -0700
@@ -1,4 +1,5 @@
-# extended LDIF
+version: 1
+
 #
 # LDAPv3
 # base <dc=stanford,dc=edu> (default) with scope subtree
@@ -261,8 +262,6 @@
 suPrivilegeGroup: ra-supportanalyst:remedy
 
 # search result
-search: 5
-result: 0 Success
 
 # numResponses: 3
 # numEntries: 2

Note the addition of the version specification, which is required for
LDIF, and (most significantly) the suppression of the
"pseudo-attributes" for the search.

-- 
Russ Allbery (rra at debian.org)               <http://www.eyrie.org/~eagle/>





More information about the Pkg-openldap-devel mailing list