gfsec-split config file path error #6

Closed
opened 2 years ago by moht · 1 comments
moht commented 2 years ago

There is a discrepancy between gfsec-split and gfsec-use with the config option.

The documentation states that « If FILE is a single filename without extension and without a directory part, the file will be placed under the DG_CONFIG_HOME/gfsecret directory with a .conf extension. »

If I run:

$ gfsec-split -c test testfile URI1 URI2 URI3
gfsec-split: Cannot write configuration file: No such file or directory

With an existing configuration file in $HOME/.config/gfsecret/test.conf:

$ gfsec-use -c test
$ # new bash session with file recombined

I guess the error is in gfsec-split because the freedesktop's XDG Base Directory Specification states that « $XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used. »

In gfsec-split.c the configuration file just check the XDG_CONFIG_HOME variable but set an empty string if not set resulting in /gfsecret/test.conf configuration filename whereas gfsec-use.c check that XDG_CONFIG_HOME is set or fallback to the expected $HOME/.config

There is a discrepancy between gfsec-split and gfsec-use with the config option. The documentation states that « If FILE is a single filename without extension and without a directory part, the file will be placed under the DG_CONFIG_HOME/gfsecret directory with a .conf extension. » If I run: ```bash $ gfsec-split -c test testfile URI1 URI2 URI3 gfsec-split: Cannot write configuration file: No such file or directory ``` With an existing configuration file in $HOME/.config/gfsecret/test.conf: ```bash $ gfsec-use -c test $ # new bash session with file recombined ``` I guess the error is in gfsec-split because the freedesktop's XDG Base Directory Specification states that « $XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used. » In `gfsec-split.c` the configuration file just check the `XDG_CONFIG_HOME` variable but set an empty string if not set resulting in `/gfsecret/test.conf` configuration filename whereas `gfsec-use.c` check that `XDG_CONFIG_HOME` is set or fallback to the expected `$HOME/.config`
Owner

OK, there’s two different issues here.

The first is that as you have noticed, gfsec-split does not adequately fallback to $HOME/.config if XDG_CONFIG_HOME is not set.

But there’s also a second issue: when attempting to create the configuration file, gfsec-split expects the parent directory to already exist. If that parent directory does not exist, gfsec-split fails with the ENOENT error, even if the XDG_CONFIG_HOME variable is properly set or if gfsec-split were to fallback to $HOME/.config.

That second issue is not necessarily a bug per se, but at the very least it’s a very surprising behavior: most users would expect the program to create the configuration directory as needed instead of requiring the user to create it beforehand.

OK, there’s two different issues here. The first is that as you have noticed, *gfsec-split* does not adequately fallback to `$HOME/.config` if `XDG_CONFIG_HOME` is not set. But there’s also a second issue: when attempting to create the configuration file, *gfsec-split* expects the parent directory to already exist. If that parent directory does not exist, *gfsec-split* fails with the `ENOENT` error, even if the `XDG_CONFIG_HOME` variable is properly set or if *gfsec-split* were to fallback to `$HOME/.config`. That second issue is not necessarily a *bug* per se, but at the very least it’s a very surprising behavior: most users would expect the program to create the configuration directory as needed instead of requiring the user to create it beforehand.
damien self-assigned this 2 years ago
damien closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.