ftphs icon indicating copy to clipboard operation
ftphs copied to clipboard

Calling nlst or dir function on FTPConnection causes the program to silently exit

Open souravdatta opened this issue 10 years ago • 2 comments

I am not entirely sure whether this issue is with the library or the Windows 7 64bit system I am using. I am new to Haskell and was trying to write a rudimentary ftp app for my own use. The test case is:

module FtpTest
        where

import Network.FTP.Client
import Network.FTP.Client.Parser

display :: Maybe String -> IO ()
display (Just path) = putStrLn path
display Nothing = putStrLn "No path!"

ftpTest :: String -> String -> String -> IO Network.FTP.Client.Parser.FTPResult
ftpTest host usr pass = do
    enableFTPDebugging
    h <- easyConnectFTP host
    login h usr (Just pass) Nothing
    (pwd, _) <- pwd h
    display pwd
    putStrLn "Going to list dir"
    fs <- dir h Nothing
    putStrLn "Done"
    quit h

When running the ftpTest function, I get the current directory and "Going to list dir" printed. But then the program exits silently. I have also tried nlst function but the behaviour is same.

The log below shows output with enableFTPDebugging.

*FtpTest> ftpTest "" "" "" Loading package array-0.5.0.0 ... linking ... done. Loading package deepseq-1.3.0.2 ... linking ... done. Loading package bytestring-0.10.4.0 ... linking ... done. Loading package Win32-2.3.0.2 ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package old-locale-1.0.0.6 ... linking ... done. Loading package time-1.4.2 ... linking ... done. Loading package containers-0.5.5.1 ... linking ... done. Loading package mtl-2.1.3.1 ... linking ... done. Loading package regex-base-0.93.2 ... linking ... done. Loading package regex-posix-0.95.2 ... linking ... : warning: isal um from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isupper from msvcrt is linked instead of __imp_isupper : warning: toupper from msvcrt is linked instead of __imp_toupper : warning: tolower from msvcrt is linked instead of __imp_tolower : warning: isalpha from msvcrt is linked instead of __imp_isalpha : warning: isalpha from msvcrt is linked instead of __imp_isalpha : warning: isalpha from msvcrt is linked instead of __imp_isalpha : warning: iscntrl from msvcrt is linked instead of __imp_iscntrl : warning: isupper from msvcrt is linked instead of __imp_isupper : warning: isgraph from msvcrt is linked instead of __imp_isgraph : warning: isprint from msvcrt is linked instead of __imp_isprint : warning: ispunct from msvcrt is linked instead of __imp_ispunct : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalpha from msvcrt is linked instead of __imp_isalpha done. Loading package regex-compat-0.95.1 ... linking ... done. Loading package text-1.1.0.0 ... linking ... done. Loading package parsec-3.1.5 ... linking ... done. Loading package old-time-1.1.0.2 ... linking ... done. Loading package network-2.4.2.3 ... linking ... : warning: inet_nt a from ws2_32 is linked instead of __imp_inet_ntoa : warning: getnameinfo from ws2_32 is linked instead of __imp_getn meinfo : warning: getaddrinfo from ws2_32 is linked instead of __imp_geta drinfo : warning: freeaddrinfo from ws2_32 is linked instead of __imp_fre addrinfo : warning: accept from ws2_32 is linked instead of __imp_accept : warning: WSACleanup from ws2_32 is linked instead of __imp_WSACl anup : warning: WSAStartup from ws2_32 is linked instead of __imp_WSASt rtup : warning: WSACleanup from ws2_32 is linked instead of __imp_WSACl anup done. Loading package filepath-1.3.0.2 ... linking ... done. Loading package directory-1.2.1.0 ... linking ... done. Loading package HUnit-1.2.5.2 ... linking ... done. Loading package process-1.2.0.0 ... linking ... done. Loading package hslogger-1.2.8 ... linking ... done. Loading package random-1.0.1.1 ... linking ... done. Loading package MissingH-1.3.0.1 ... linking ... done. Loading package ftphs-1.0.9.1 ... linking ... done. FTP received: 220 (vsFTPd 2.0.5) FTP sent: USER FTP received: 331 Please specify the password. FTP sent: PASS FTP received: 230 Login successful. FTP sent: PWD FTP received: 257 "/home/uname" /home/uname Going to list dir FTP sent: TYPE A FTP received: 200 Switching to ASCII mode. FTP sent: PASV FTP received: 227 Entering Passive Mode (10,240,106,18,41,229)

System information:

OS - Windows 7 64 bit Haskell - Fresh installation of Haskell platform downloaded from the distribution site. ftphs - installed using Cabal.

souravdatta avatar Mar 02 '15 10:03 souravdatta

Also, I have tested this on a Mac and Ubuntu box, connecting to the same FTP server and that worked, so the problem is Windows specific.

souravdatta avatar Mar 04 '15 05:03 souravdatta

I have the same issue. Apparently the libs are not usable for windows.

wochinge avatar May 08 '15 13:05 wochinge