[Haskell-cafe] What is the difference between runhaskell and compile?

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Thu Jul 12 08:03:04 CEST 2012


I made a little code, to explicitly use unbind:
ldapWith :: String
         -> LDAPInt
         -> (LDAP -> IO a)
         -> IO a
ldapWith host port f =
  withCString host $ \cs -> do
    cld <- cldap_init cs port
    ptr <- checkNULL "ldapWith" (return cld)
    rv <- newForeignPtr_ ptr
    ldapSetVersion3 cld
    a <- f rv
    _ <- cldap_unbind cld
    return a

And it gave me another packet data. Sec 11 is runhaskell, Sec 15 is
binary (failed). The failed one has a FIN, ACK, weird. LDAP-0.6.6 is a
binding to c library without any other haskell library except base, I
think how ghc works should not effect its internal network
operation....

On Thu, Jul 12, 2012 at 10:14 AM, Magicloud Magiclouds
<magicloud.magiclouds at gmail.com> wrote:
> Dug a little more. Seems that ghc 7.4.* finalizes (ldap_unbind action)
> the ldap ptr before the references were actually dropped.
>
> On Thu, Jul 12, 2012 at 9:41 AM, Magicloud Magiclouds
> <magicloud.magiclouds at gmail.com> wrote:
>> Sorry for the attachments. They are wireshark files.
>>
>> On Thu, Jul 12, 2012 at 9:35 AM, Magicloud Magiclouds
>> <magicloud.magiclouds at gmail.com> wrote:
>>> OK. Finally this problem totally prevents my project from working.
>>> By some guy's suggestion, I did a packet capturing, which really
>>> showed a difference.
>>> The rwdc file is for a ldap that at our IDC, which did not work with
>>> compiled binary. The rodc file is for a ldap that at local, which
>>> worked all the time. Each file contains two parts of records, at 3.*
>>> sec and 6/7.* sec. The 3.* part is for runhaskell way. The 6/7.* part
>>> is for compiled binary way.
>>> The big difference here is: the failed one sent unbindRequest before
>>> got bindResponse success.
>>> Just a clue, I have no idea what is going on....
>>>
>>> On Fri, Jun 1, 2012 at 5:17 PM, Chris Dornan <chris at chrisdornan.com> wrote:
>>>> No problem -- I have attached the executable too.
>>>>
>>>> Chris
>>>>
>>>> -----Original Message-----
>>>> From: Magicloud Magiclouds [mailto:magicloud.magiclouds at gmail.com]
>>>> Sent: 01 June 2012 02:01
>>>> To: Chris Dornan
>>>> Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile?
>>>>
>>>> I see.
>>>> Although I am using a UTF-8 environment, but all string I was using were ASCIIs.
>>>> If it is not too much trouble, may I have your LDAP compiled library files? I think since the Main.o is identical, maybe the libraries are different.
>>>>
>>>> On Thu, May 31, 2012 at 2:09 PM, Chris Dornan <chris at chrisdornan.com> wrote:
>>>>> I wouldn't pay too much attention to the fact that the hash tags are
>>>>> different -- they are very unlikely to be the same across two
>>>>> installations. (For example, my GHC installations are relocated under
>>>>> /usr/hs, immediately changing the contents of all of the .conf files
>>>>> and therefore the hashes.)
>>>>>
>>>>> The object files are more interesting, and they are identical!
>>>>>
>>>>> At the moment I can only explain what we are seeing by assuming that some change has affected the GHC 7.4.1 runtime system -- but only for compiled programs.
>>>>>
>>>>> Are you using non-ASCII characters in your LDAP passwords? I am thinking that maybe the compiled 7.4.1 could be using a different LOCALE from everything else, leading in some way to the passwords being encoded differently en route to the LDAP server. I don't know whether this could actually happen, but it is the kind of mechanism that seem most likely to be causing the problem.
>>>>>
>>>>> Did you try to running the variants that read address, account and passwords from standard input? Did it show the same perverse behaviour?
>>>>>
>>>>> Chris
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Magicloud Magiclouds [mailto:magicloud.magiclouds at gmail.com]
>>>>> Sent: 31 May 2012 02:47
>>>>> To: Chris Dornan
>>>>> Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile?
>>>>>
>>>>> Hi,
>>>>>  I have compared the files. The .o-es are exactly the same. The .hi-s are different.
>>>>>  The interface hash, flag hash, and "import  -/ LDAP-0.6.6:LDAP.Constants xxxxx(hash)" are different.
>>>>>  I do not know why only this module (LDAP.Constants) has a different hash. I am not quite familiar with ghc compiling process. May I know your conclusion?
>>>>>
>>>>> On Wed, May 30, 2012 at 3:50 PM, Chris Dornan <chris at chrisdornan.com> wrote:
>>>>>> Did you carry out a standard (optimised) build to get ghc-7.4.1?
>>>>>>
>>>>>> Are you going to try the justhub rpms or compare the object/header files I sent.
>>>>>>
>>>>>> Chris
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Magicloud Magiclouds [mailto:magicloud.magiclouds at gmail.com]
>>>>>> Sent: 30 May 2012 04:07
>>>>>> To: Chris Dornan
>>>>>> Cc: Haskell-Cafe
>>>>>> Subject: Re: [Haskell-cafe] What is the difference between runhaskell and compile?
>>>>>>
>>>>>> A little information.
>>>>>> I did not notice the gcc/binutils versions. But in CentOS, the ghc
>>>>>> 7.2.2/7.4.1 were all compiled myself with all default configurations.
>>>>>>
>>>>>> On Tue, May 29, 2012 at 10:54 PM, Chris Dornan <chris at chrisdornan.com> wrote:
>>>>>>> On 29 May 2012 02:21, Magicloud Magiclouds
>>>>>>> <magicloud.magiclouds at gmail.com> wrote:
>>>>>>>> Interesting. I have this code tested in Debian unstable/stable,
>>>>>>>> CentOS 6.1, all 64 bit, with two different version of libldap2.
>>>>>>>> At first, Debian-s were installed with 7.4.1, CentOS with 7.2.2.
>>>>>>>> Only in CentOS the code connected after compiled.
>>>>>>>> Then I removed 7.4.1 from Debian stable and installed 7.2.2. The code worked.
>>>>>>>> At last, I installed 7.4.1 in CentOS. The code did not work.
>>>>>>>>
>>>>>>>> Could you send the .hi/.o to me, so maybe I could find out the
>>>>>>>> different? Also the exact original source.
>>>>>>>> Thank you.
>>>>>>>
>>>>>>> Interesting indeed! I am guessing that you are using the GHC-7.4.1
>>>>>>> bindist from haskell.org.
>>>>>>>
>>>>>>> I will try and find some time to marshal the source code and
>>>>>>> intermediate files (am on the road -- will need to collect it from
>>>>>>> base, make it generic etc.).
>>>>>>>
>>>>>>> You might also like to try the http://justhub.org ghc-7.4.1-hub on
>>>>>>> your CentOS-6.1 node. It is a separate build from the haskell.org
>>>>>>> bindist and comes with it's own in-board gcc (4.6.1) and binutils
>>>>>>> (2.21) used for the build. It should work for you.
>>>>>>>
>>>>>>> (You could also try ghc-7.4.2-RC1-hub.)
>>>>>>>
>>>>>>> Chris
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 竹密岂妨流水过
>>>>>> 山高哪阻野云飞
>>>>>>
>>>>>> And for G+, please use magiclouds#gmail.com.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 竹密岂妨流水过
>>>>> 山高哪阻野云飞
>>>>>
>>>>> And for G+, please use magiclouds#gmail.com.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 竹密岂妨流水过
>>>> 山高哪阻野云飞
>>>>
>>>> And for G+, please use magiclouds#gmail.com.
>>>
>>>
>>>
>>> --
>>> 竹密岂妨流水过
>>> 山高哪阻野云飞
>>>
>>> And for G+, please use magiclouds#gmail.com.
>>
>>
>>
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>>
>> And for G+, please use magiclouds#gmail.com.
>
>
>
> --
> 竹密岂妨流水过
> 山高哪阻野云飞
>
> And for G+, please use magiclouds#gmail.com.



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unbind
Type: application/octet-stream
Size: 635063 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120712/1d491e51/attachment-0001.obj>


More information about the Haskell-Cafe mailing list