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

XDG_CONFIG_HOME support does not follow spec #8208

Closed
SuperSandro2000 opened this issue Jan 2, 2022 · 6 comments
Closed

XDG_CONFIG_HOME support does not follow spec #8208

SuperSandro2000 opened this issue Jan 2, 2022 · 6 comments
Assignees

Comments

@SuperSandro2000
Copy link

I did this

I created ~/.config/curlrc with only head in it which should be picked up if curl has correct XDG_CONFIG_HOME support.

I expected the following

That the next curl command I execute shows me headers.

What actually happened

curl expects the file to be in ~/.config/.curlrc and the XDG_CONFIG_HOME env needs to be set to ~/.config/.

How it should actually work

curl should treat an unset XDG_CONFIG_HOME env as being equal to $HOME/.config. See https://wiki.archlinux.org/title/XDG_Base_Directory#User_directories

Also the curlrc file under XDG_CONFIG_HOME should not require a dot in the beginning.

curl/libcurl version

curl 7.80.0 (x86_64-pc-linux-gnu) libcurl/7.80.0 OpenSSL/3.0.1 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.1 libpsl/0.21.0 (+libidn2/2.3.0) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.6
Release-Date: 2021-11-10
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

operating system

Linux host 5.13.0-21-generic #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
@bagder
Copy link
Member

bagder commented Jan 2, 2022

curl should treat an unset XDG_CONFIG_HOME env as being equal to $HOME/.config

I think it says that curl should, if XDG_CONFIG_HOME is unset, work as if it was set to ~/.config. Meaning that ~/ is not necessarily $HOME, as finding the home dir is done using a few different mechanisms.

And this of course makes this a complicated maze of decisions...

@SuperSandro2000
Copy link
Author

I think it says that curl should, if XDG_CONFIG_HOME is unset, work as if it was set to ~/.config.

That should be close enough to work as expected.

The decisions which would need to be made would be basically the following:

  1. Is XDG_CONFIG_HOME set?
    1.1. If not, set it to ~/.config
  2. Does XDG_CONFIG_HOME/curlrc exist?
    2.1 if it does exist use it else continue checking for configs

@bagder
Copy link
Member

bagder commented Jan 2, 2022

The decisions which would need to be made would be basically the following:

I wish it was that simple: https://github.com/curl/curl/blob/master/src/tool_findfile.c

bagder added a commit that referenced this issue Jan 2, 2022
... after the initial checks for .curlrc and if XDG_CONFIG_HOME is not
set, use $HOME and $CURL_HOME to check if ~/.config/curlrc is present.

Add test 436 to verify

Reported-by: Sandro Jaeckel
Fixes #8208
@bagder bagder self-assigned this Jan 2, 2022
bagder added a commit that referenced this issue Jan 3, 2022
... after the initial checks for .curlrc and if XDG_CONFIG_HOME is not
set, use $HOME and $CURL_HOME to check if ~/.config/curlrc is present.

Add test 436 to verify

Reported-by: Sandro Jaeckel
Fixes #8208
bagder added a commit that referenced this issue Jan 3, 2022
... after the initial checks for .curlrc and if XDG_CONFIG_HOME is not
set, use $HOME and $CURL_HOME to check if ~/.config/curlrc is present.

Add test 436 to verify

Reported-by: Sandro Jaeckel
Fixes #8208
@bagder bagder closed this as completed in 764e4f0 Jan 7, 2022
@borland502
Copy link

The decisions which would need to be made would be basically the following:

I wish it was that simple: https://github.com/curl/curl/blob/master/src/tool_findfile.c

Well thank you for implementing the XDG support in the first place. It calms my OCD to clear out dotfiles from the home dir.

@b-jazz
Copy link

b-jazz commented Oct 15, 2023

I'm running curl 8.4.0 and I'm still seeing this behavior. This should be fixed in this version, right? Moving ~/.config/curlrc to ~/.config/.curlrc reads the config correctly, so it isn't a problem in the format of my rc (which simply contains --no-progress-meter). I have $XDG_CONFIG_HOME set, and there is no $CURL_HOME set.

@jay
Copy link
Member

jay commented Oct 15, 2023

I'm running curl 8.4.0 and I'm still seeing this behavior. This should be fixed in this version, right?

I don't know... please take further discussion to #12129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants