Invalid BitString value #13

Closed
vmas opened this Issue Mar 19, 2013 · 7 comments

Projects

None yet

2 participants

@vmas
Contributor
vmas commented Mar 19, 2013

I'm trying the following:

foreach(bool bit in new BitString(true, 33))
{
     Console.WriteLine(bit);
}

this printing a "true, false, false, false, ..." instead "true, true, true, ..."

@franciscojunior
Member

Nice catch!

It is a bug in Npgsql. It seems that any value higher than 32 bits is having this problem.

I already wrote the following test case which shows the problem:

public void BitStringMoreThan32Bits()
{
// This test was created based on this git issue: #13

        BitString b = new BitString (true, 33);

        Assert.AreEqual ("111111111111111111111111111111111", b.ToString ());

}

Would you mind to fill a bug report on our project so we can track it?
http://bugs.npgsql.org

Thank you in advance.

@franciscojunior
Member

Thank you!
Em 20/03/2013 19:31, "vmas" notifications@github.com escreveu:

Ok. I added, bug 1011321 (
http://pgfoundry.org/tracker/index.php?func=detail&aid=1011321&group_id=1000140&atid=590
)
Thanks.


Reply to this email directly or view it on GitHubhttps://github.com/franciscojunior/Npgsql2/issues/13#issuecomment-15207995
.

@franciscojunior
Member

It is fixed in cvs. Jon Hanna created a patch. Please, give it a try from cvs and let me know if it works ok for you.

@vmas
Contributor
vmas commented Apr 5, 2013

Unfortunately, i can't download code from CVS. I get: cvs [login aborted]: end of file from server (consult above messages if any).

I downloaded this patch from bugtracker and applied this patch to source in GitHub. It work ok for me.

@franciscojunior
Member

Sorry about that. I think pgfoundry is still having problems with anon cvs
access. :(

I'm glad to know it worked for you. There is still another problem you
should add to your code to fix the bug completely.

Replace the line 91 of BitString.cs file with those:

if(count % 32 != 0)
_chunks.Add(0xFFFFFFFFu << - count);

Thanks for your feedback.

On Fri, Apr 5, 2013 at 5:37 PM, vmas notifications@github.com wrote:

Unfortunately, i can't download code from CVS. I get: cvs [login aborted]:
end of file from server (consult above messages if any).

I downloaded this patch from bugtracker and applied this patch to source
in GitHub. It work ok for me.


Reply to this email directly or view it on GitHubhttps://github.com/franciscojunior/Npgsql2/issues/13#issuecomment-15979349
.

Regards,

Francisco Figueiredo Jr.
Npgsql Lead Developer
http://www.npgsql.org
http://gplus.to/franciscojunior
http://fxjr.blogspot.com
http://twitter.com/franciscojunior

@vmas
Contributor
vmas commented Apr 5, 2013

Ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment