【问题标题】:RCurl dumps core with option ftpupload=TRUERCurl 使用选项 ftpupload=TRUE 转储核心
【发布时间】:2018-09-11 15:16:48
【问题描述】:

我尝试将一个小文件 ftp 上传到我 必须 与“活动”ftp(curl -P 选项)一起使用的 ftp 服务器,我的 R 会话转储核心。知道这里发生了什么,我必须将哪些选项传递给RCurl::ftpUpload()

.opts <- list("verbose" = TRUE, "ftp.use.epsv" = FALSE, 
    "ftp.use.eprt" = TRUE, "connecttimeout" = 3, ftpport=TRUE)
myfile <- "path/myfile.json"
file.exists(myfile)   # returns  TRUE

cmd <- sprintf("ftp://%s:%s@myserver.de/mytargetdir/%s", 
   Sys.getenv("R__ftpuser"), Sys.getenv("R__ftppw"), 
   basename(myfile))
ftpUpload(myfile, cmd, .opts=.opts)

* 发现段错误 * 地址 0x1,导致“内存未映射”

Traceback:
 1: curlPerform(url = to, upload = TRUE, readfunction = uploadFunctionHandler(file,     asText), ..., curl = curl)
 2: ftpUpload(myfile, cmd, .opts = .opts)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

我的 R 会话:

R version 3.4.4 (2018-03-15)  for linux
RCurl version 1.95-4.11

命令行调用有效:

curl -P - myfile ftp://... -T --disable-eprt #uploads the file

我的卷发:

curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets

当我离开 ftpport=TRUE 选项时,会出现超时。

R --vanilla 也会发生这种情况

【问题讨论】:

  • 确保您使用的是最新版本的 RCurl;我有packageVersion("RCurl") 为我返回[1] '1.95.4.11'。这可能需要维护者进行修复,因此您应该联系他们maintainer("RCurl"),最好使用完全可重现的示例。 curl 包是否提供类似的功能?

标签: r curl rcurl


【解决方案1】:

回答我自己的问题:

选项值必须是"-" 而不是TRUE

.opts <- list("verbose" = TRUE, "ftp.use.epsv" = FALSE, "ftpport" = "-",
              "ftp.use.eprt" = TRUE, "connecttimeout" = 3)
ftpUpload(myfile, cmd, .opts=.opts)

那么输出将如下所示:

< 150 Opening BINARY mode data connection for myfile.json
* Preparing for accepting server on data port
* Checking for server connect
* Ready to accept data connection from server
* Connection accepted from server
* Remembering we are in dir "some/dir/"
< 226 Transfer complete
* Connection #0 to host myserver.de left intact

此行为记录在此处https://curl.haxx.se/libcurl/c/CURLOPT_FTPPORT.html

PORT 指令告诉远程服务器连接到我们的 指定的 IP 地址。该字符串可以是普通 IP 地址、主机 名称、网络接口名称(在 Unix 下)或只是一个 '-' 符号 让库使用您系统的默认 IP 地址。

(强调我的)

【讨论】:

    猜你喜欢
    • 2015-05-12
    • 2015-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-29
    • 2015-11-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多