Skip to content

curl tool won't search for curlrc (no leading dot) in XDG_CONFIG_HOME #12129

@jay

Description

@jay

I did this

@b-jazz reported in #8208 (comment) that when curl is searching for the .curlrc file, it searches XDG_CONFIG_HOME for .curlrc but does not search it for curlrc (no leading dot).

The original reporter of #8208 reported that as well. When that issue was fixed by 764e4f0 it did not fix that part of the issue. Instead it was written in a specific way to not do that. findfile will search for curlrc (no leading dot) in $CURL_HOME/.config/curlrc and $HOME/.config/curlrc, but only if XDG_CONFIG_HOME is not set and .curlrc has not been found anywhere else.

Here's two typical setups and how curl currently behaves:

If CURL_HOME is not set, and XDG_CONFIG_HOME is set, and HOME is set, then the order is:

  • $XDG_CONFIG_HOME/.curlrc
  • $HOME/.curlrc
  • pw_dir/.curlrc

If CURL_HOME is not set, and XDG_CONFIG_HOME is not set, and HOME is set, then the order is:

  • $HOME/.curlrc
  • $HOME/.config/curlrc (this path is checked because XDG_CONFIG_HOME is not set)
  • pw_dir/.curlrc

Note pw_dir is usually the same as $HOME.

Note for brevity I've excluded how we also search for _curlrc when .curlrc is not found, since that logic just complicates understanding this and AFAICT it's not relevant here.

I expected the following

I'm not sure if this is a bug or not since the commit was written specifically not to strip the dot from curlrc when checking XDG_CONFIG_HOME, and I can't figure from the discussion why it was done that way.

curl/libcurl version

curl 8.4.0

operating system

Linux

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions