Handling of configuration files
Right now Wget2 reads /etc/wgetrc
and then the user's local wgetrc file based on $WGETRC
variable, $XDG_CONFIG_HOME/.wgetrc
or ~/.wgetrc
as its configuration file.
This poses a new problem for both Wget and Wget2: Options that are not compatible across the two versions of Wget, and how they should be handled.
For example, an existing Wgetrc file may have the option: xattr = on
or progress = dot
These options are not currently supported by Wget2 and as a result, wget2 will fail on startup.
Similarly, for wget2, I'd like to have the options progress = bar
or ocsp-file = somefile
which are not supported by Wget 1.x hence causing that fail on startup.
One of the chief problems I see here is the fact that we are trying to support the same config file for both versions of Wget. A few solutions were discussed on the comments for commit 6b2d9296
- Wget2 potentially uses different config file,
~/.wget2rc
and similarly environment variable,$WGET2RC
- Both wget and wget2 are changed to fail on an invalid config option but to print a warning
- Both wget and wget2 support including a config file from another config file.
- Modify syntax of wgetrc to have versioned commands
Each of these solutions have their pros and cons. However, we must decide on one ASAP before the alpha release. An important aspect to remember is that the .wgetrc
MUST remain backward compatible.
- Using different configuration files is a nice clean solution. No change required in either program. However, this increases configuration duplication and is more effort for the end user
- I do not like the idea of ignoring and printing a warning. If Wget / Wget2 print a warning on every startup, the users will be trained in ignoring the warnings and will never pay any heed to it. That just makes this excess data printed to stdout.
- Including a config file is a clean solution, but increases fragmentation. It now requires a user to maintain 3 config files. A master (common) wget config and a specific config for each version. Also, this must be done along with the first option to split the configuration files read by each
- Versioned commands in wgetrc will require changes to both Wget and Wget2 and it must be done such that existing wgetrc files just work. One way to implement this would be to add a "v1" or "v2" after the command syntax in wgetrc to denote that this specific command should only be executed on the given version. By default commands are always executed.