Net::LDAP 0.0.4 filter warnings

B

barjunk

I'm writing some new code and using #!/usr/bin/ruby -w as the bang line
in the script.

The code looks like:

require 'rubygems'
require 'net/ldap'

<snip>

filter = Net::LDAP::Filter.eq( "key","value" )
ldap.search :)base =>treebase, :filter => filter)

<snip>

I get:

/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:310:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:311:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:324:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:338:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:356:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:358:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:360:
warning: ambiguous first argument; put parentheses or even spaces


These warnings occurs after the filter line but before the search line.

This looks like it is at the lines that have:

scanner.scan <someregex>

What needs to be done to make those warnings go away?

Mike B.
 
F

Francis Cianfrocca

I'm writing some new code and using #!/usr/bin/ruby -w as the bang line
in the script.

The code looks like:

require 'rubygems'
require 'net/ldap'

<snip>

filter = Net::LDAP::Filter.eq( "key","value" )
ldap.search :)base =>treebase, :filter => filter)

<snip>

I get:

/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:310:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:311:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:324:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:338:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:356:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:358:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:360:
warning: ambiguous first argument; put parentheses or even spaces


These warnings occurs after the filter line but before the search line.

This looks like it is at the lines that have:

scanner.scan <someregex>

What needs to be done to make those warnings go away?

Mike B.

Well that's odd! Never saw that in any of my testing. What version of
Ruby are you using? I've patched the code in Rubyforge. Sync to the
latest and see if the problem goes away.

Come to think of it, I don't like this very much. There should have
been no warnings. The code path you're looking at is a recursive
descent parser, and it got touched a few days ago. If you're feeling
frisky, would you please get version 0.0.3 of Net::LDAP and see if you
get the same problem? Perhaps a regression crept into 0.0.4.
 
F

Francis Cianfrocca

I'm writing some new code and using #!/usr/bin/ruby -w as the bang line
in the script.

The code looks like:

require 'rubygems'
require 'net/ldap'

<snip>

filter = Net::LDAP::Filter.eq( "key","value" )
ldap.search :)base =>treebase, :filter => filter)

<snip>

I get:

/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:310:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:311:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:324:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:338:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:356:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:358:
warning: ambiguous first argument; put parentheses or even spaces
/usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:360:
warning: ambiguous first argument; put parentheses or even spaces


These warnings occurs after the filter line but before the search line.

This looks like it is at the lines that have:

scanner.scan <someregex>

What needs to be done to make those warnings go away?

Mike B.

I can't get those warnings to appear, and I tried all kinds of ways.
Also, they occur in a code path that is not exercised by your code
sample. Can you send me a whole program that exhibits the flaw?
(Private email is fine.)
 
F

Francis Cianfrocca

These warnings occurs after the filter line but before the search line.

This looks like it is at the lines that have:

scanner.scan <someregex>

What needs to be done to make those warnings go away?


Umm... any feedback, Barjunk? If this is not a real problem, I want to
rollback the code changes I made.
 
D

Daniel Berger

Francis said:
Umm... any feedback, Barjunk? If this is not a real problem, I want to
rollback the code changes I made.
They show up if you run with -w. Personally, I think the parens help
with readability in this case.

Just my .02.

Regards,

Dan
 
F

Francis Cianfrocca

They show up if you run with -w. Personally, I think the parens help
with readability in this case.

Just my .02.

Regards,

Dan


Got it. Thanks, Dan. I outsmarted myself- I thought about -w (which
barjunk mentioned) but instead of testing it the easy way, I added
$VERBOSE=true to my test script, and that didn't produce any warnings.

The current version in Rubyforge SVN does not give the warnings. I'll
hold off another release for a few days in case anything else turns
up.
 
B

barjunk

Francis said:
Got it. Thanks, Dan. I outsmarted myself- I thought about -w (which
barjunk mentioned) but instead of testing it the easy way, I added
$VERBOSE=true to my test script, and that didn't produce any warnings.

The current version in Rubyforge SVN does not give the warnings. I'll
hold off another release for a few days in case anything else turns
up.

Sorry for the late response...I only get digests and have been busy on
a project. I will update to the latest and see what happens.

Mike B.
 
B

barjunk

barjunk said:
Sorry for the late response...I only get digests and have been busy on
a project. I will update to the latest and see what happens.

Mike B.

I don't have an svn client at the moment and not going to be able to
(time wise) be able to get to that any time soon...if you can build a
gem for me, I'll be able to test it easily. Sorry about that.

Mike B.
 
F

Francis Cianfrocca

I don't have an svn client at the moment and not going to be able to
(time wise) be able to get to that any time soon...if you can build a
gem for me, I'll be able to test it easily. Sorry about that.

I think the ML bounced it. I emailed it to your private email.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top