Package: libghc-curl-dev
Version: 1.3.8-9+b1
Severity: normal

When I run the attached script/program (small, reduced to a test-case) the 
callback function I register with the "CurlProgressFunction" option doesn't 
appear to get called.  Additionally the output file "libc6.deb" is smaller than 
it should be.

When I get a chance, I will upgrade my haskell install and try again with a 
later version of libghc-curl-dev, although judging by the debian-changelog, it 
seems unlikely that there will be any difference.

I am a beginner-to-intermediate haskell programmer, so this problem may be due 
to a mix of user-error and poor documentation for libghc-curl-dev.

-- System Information:
Debian Release: 7.7
  APT prefers oldstable
  APT policy: (990, 'oldstable'), (500, 'oldoldstable'), (500, 'oldstable')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-9-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libghc-curl-dev depends on:
ii  ghc [libghc-containers-dev-0.5.7.1-0ba60]  8.0.1-17
ii  libc6                                      2.28-8
ii  libcurl3-gnutls                            7.43.0-1
ii  libcurl4-openssl-dev                       7.52.1-5+deb9u4
pn  libghc-base-dev-4.9.0.0-1bac3              <none>
pn  libghc-bytestring-dev-0.10.8.1-3ddfb       <none>
ii  libgmp10                                   2:6.1.2+dfsg-1

libghc-curl-dev recommends no packages.

Versions of packages libghc-curl-dev suggests:
ii  libghc-curl-doc   1.3.8-9
pn  libghc-curl-prof  <none>

-- no debconf information
#!/usr/bin/runghc

module Main where

import Foreign.C.Types (CInt)
import Network.Curl as Curl
import Network.Curl.Code
import Network.Curl.Easy as CurlEasy
import Network.Curl.Opts (CurlOption(..))
import System.IO

curl_print_status ptr dltotal dlnow ultotal ulnow = do
  putStrLn "Progress"
  return ((fromIntegral 0) :: CInt)

download_to_file = Curl.withCurlDo $ do
  let url = 
"http://ftp.us.debian.org/debian/pool/main/g/glibc/libc6_2.24-11+deb9u4_i386.deb";
  let outfile = "./libc6.deb"
  curl_inst <- CurlEasy.initialize

  r <- setopt curl_inst (CurlURL url)
  r2 <- setopt curl_inst (CurlHttpGet True)
  r3 <- setopt curl_inst (CurlProgressFunction curl_print_status)

  out <- openBinaryFile outfile WriteMode
  r4 <- setopt curl_inst (CurlWriteFunction (callbackWriter (hPutStr out)))
  
  r5 <- Curl.perform curl_inst
  hFlush out
  hClose out

main = do
  download_to_file

Reply via email to