In the process I discovered a bug/less intuitive setting precedence.
Here is an example to reproduce the issue:
RCLONE_SKIP_LINKS = true #superseeds the rclone default
RCLONE_LOCAL_SKIP_LINKS = false #intuitively supersedes the above
RCLONE_CONFIG_MYLOCAL_SKIP_LINKS = false #intuitively supersedes both above
rclone lsd myLocal:/folder/with/symlinks -vv
Intuitively expected result: folder listing with symlink warnings
Actual result: folder listing without symlink warnings (RCLONE_SKIP_LINKS has precedence)
The precedence is described here, and it actually doesn’t describe the above situation.
Does the result correspond to your expectation?
Do we aim a clarifying the docs or fixing the code?
(You may now be thinking about using flag.Changed, to differ between flags set by the command line and the environment variables. But this difference is exactly what caused the issues I have just fixed - by making sure that flag.Changed is also being set by environment variables )
I did a little test to verify what you are saying - I patched the drive backend to exit with an error reporting the state of use trash
$ rclone lsf drive:
2021/05/17 15:21:01 Failed to create file system for "drive:": UseTrash=true
$ RCLONE_DRIVE_USE_TRASH='false' rclone lsf drive:
2021/05/17 15:21:25 Failed to create file system for "drive:": UseTrash=false
$ RCLONE_DRIVE_USE_TRASH='false' RCLONE_CONFIG_DRIVE_USE_TRASH='true' rclone lsf drive:
2021/05/17 15:21:39 Failed to create file system for "drive:": UseTrash=false
$ RCLONE_CONFIG_DRIVE_USE_TRASH='true' rclone lsf drive:
2021/05/17 15:21:47 Failed to create file system for "drive:": UseTrash=true
Yes I think you are right - RCLONE_DRIVE_USE_TRASH and RCLONE_CONFIG_MYREMOTE_USE_TRASH should swap places.
This is because RCLONE_DRIVE_USE_TRASH is equivalent to the command line value (in fact it sets the default value for it)
The Parameters in connection strings need to be there too
So I think the correct docs should be
Parameters in connection strings, e.g. myDrive,use_trash:
Flag values as supplied on the command line, e.g. --drive-use-trash.
Command line flags set by environment vars, e.g. RCLONE_DRIVE_USE_TRASH.
Remote specific environment vars, e.g. RCLONE_CONFIG_MYREMOTE_USE_TRASH (see above).
Config file, e.g. use_trash = false.
Default values, e.g. true - these can't be changed.
It makes more sense for them to be as they were documented, but it obviously doesn't work like that! Connection strings are a far more reliable way of doing this sort of thing than RCLONE_CONFIG_MYREMOTE_USE_TRASH so hopefully that will become less common.
Ah... These are for global command line options which were missed in the first instance because their environment variables have two spellings RCLONE_SKIP_LINKS and RCLONE_LOCAL_SKIP_LINKS.
Maybe we should regularize that... Make the config variables read both the variant environment variables at the same time and get rid of this Backend specific environment vars, e.g. RCLONE_LOCAL_SKIP_LINKS. level...