Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl 8.10 Directory Listing to File Uses LF instead of CRLF #14873

Closed
finkjsc opened this issue Sep 11, 2024 · 8 comments
Closed

Curl 8.10 Directory Listing to File Uses LF instead of CRLF #14873

finkjsc opened this issue Sep 11, 2024 · 8 comments
Assignees
Labels

Comments

@finkjsc
Copy link

finkjsc commented Sep 11, 2024

I did this

curl ftp.funet.fi/ -o list.txt

I expected the following

Output file with CRLF line terminations instead of LF only.

Is this supposed to be the new default behavior now?

Default was CRLF in v8.9 and earlier versions.

Breaks everything that was expecting CRLF since forever.

curl/libcurl version

curl 8.10.0 (x86_64-w64-mingw32) libcurl/8.10.0 LibreSSL/3.9.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 WinIDN libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.63.0 ngtcp2/1.7.0 nghttp3/1.5.0
Release-Date: 2024-09-11
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli CAcert HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL SSPI threadsafe UnixSockets zstd

operating system

Windows 10 Pro 64 22H2

@dfandrich
Copy link
Contributor

dfandrich commented Sep 11, 2024 via email

@finkjsc
Copy link
Author

finkjsc commented Sep 11, 2024

I been using curl even before v7.6 to get FTP directory lists into a file and they always had CRLF line endings before v8.10.

Did you look at the output file created from the example under Windows?

Even loading the output file created with v8.10 into Notpad shows Unix LF encoding in the status bar but Windows CRLF encoding with the output file created with 8.9 and earlier.

Something has changed with v8.10.

@dfandrich
Copy link
Contributor

dfandrich commented Sep 11, 2024 via email

@finkjsc
Copy link
Author

finkjsc commented Sep 11, 2024

--use-ascii has no effect

With Windows the example output file under v8.9 and earlier is 596 bytes, but only 589 bytes under v8.10.

Clearly since the example output file has 7 lines, v8.10 is missing the CR per line.

For now I solved this issue by splitting the lines by LF if no CRLF.

@finkjsc
Copy link
Author

finkjsc commented Sep 11, 2024

Does it happen if commit [eeb7c12] is reverted?

Not able to do this.

@vszakats vszakats added FTP Windows Windows-specific labels Sep 12, 2024
@dfandrich
Copy link
Contributor

dfandrich commented Sep 12, 2024 via email

@finkjsc
Copy link
Author

finkjsc commented Sep 12, 2024

Yes, that version works.
Line encodings have CRLF
Example output file is 596 bytes

@dfandrich
Copy link
Contributor

@bagder it sounds like this might have been a side effect of eeb7c12.

bagder added a commit that referenced this issue Sep 12, 2024
Since ASCII transfers on FTP means sending CRLF line endings, we should
still keep converting them to LF-only on platforms where text files
typically do not use CRLF.

Regression from eeb7c12 shipped in 8.10.0

Reported-by: finkjsc on github
Fixes #14873
@bagder bagder self-assigned this Sep 12, 2024
bagder added a commit that referenced this issue Sep 13, 2024
Since ASCII transfers on FTP means sending CRLF line endings, we should
still keep converting them to LF-only on platforms where text files
typically do not use CRLF.

Regression from eeb7c12 shipped in 8.10.0

Reported-by: finkjsc on github
Fixes #14873
@bagder bagder closed this as completed in 7eda757 Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

4 participants