Main icon indicating copy to clipboard operation
Main copied to clipboard

rclone: persist break the support of the existing configuration

Open PeeZu opened this issue 5 years ago • 17 comments

Hi Guys, Sorry I'm bit late but this change break the support of the existing configuration as describe here : https://rclone.org/docs/#config-config-file

Rclone will look for an existing configuration file in any of the following locations, in priority order:

1. rclone.conf (in program directory, where rclone executable is)
2. %APPDATA%/rclone/rclone.conf (only on Windows)
3. $XDG_CONFIG_HOME/rclone/rclone.conf (on all systems, including Windows)
4. ~/.config/rclone/rclone.conf (see below for explanation of ~ symbol)
5. ~/.rclone.conf

Indeed, as the rclone.conf persist now, only the first options is considered by default/priority

My last update has broke my existing configuration, now I need to pass the --config flags each time....

Originally posted by @PeeZu in https://github.com/ScoopInstaller/Main/issues/1634#issuecomment-964152900

PeeZu avatar Nov 09 '21 14:11 PeeZu

/cc @CrendKing @erisa

rashil2000 avatar Nov 09 '21 14:11 rashil2000

Can you explain your use case? Where did you store your rclone.conf? Are there multiple of them?

If you were using %APPDATA%/rclone/rclone.conf, can you move it to the rclone app dir?

CrendKing avatar Nov 09 '21 14:11 CrendKing

I believe the case here is that they have an existing rclone.conf in one of the other directories, but now it will always prefer the persisted local one because it exists.

Erisa avatar Nov 09 '21 15:11 Erisa

@PeeZu If you used to have one rclone.conf in one of the other location, can you move it to the same directory as rclone? Let us know if it doesn't work for you. You only have to do this once. The file is preserved across updated.

This change aims to make rclone portable.

CrendKing avatar Nov 10 '21 00:11 CrendKing

Can you explain your use case? Where did you store your rclone.conf? Are there multiple of them?

It's exactly what @Erisa said, my configuration was already persisting in one other allowed location.

Now, with this change only one location is supported and honestly I can't see the advantage to force user to use this location over other ones.

In addition, "persistency" was already supported by using others location, updating binaries should not break configuration IMO.

In my case, I use as more I can the XDG_CONFIG_HOME specification as a toon of software support it. https://wiki.archlinux.org/title/XDG_Base_Directory

But for sure, I can change all my servers using rclone installed by scoop to use the --config flags to point on my persistency config location, but I think it's not the rule of scoop to change the usage behavior of any installed software.

PeeZu avatar Nov 10 '21 12:11 PeeZu

I completely understand your concerns I just want to point out the reason the config file was persisted in this way and folder is because it makes it portable. If you pull out the whole scoop folder or share it between machines, it will always use the same config for that scoop instance. Portability is always nice where it doesnt conflict, except apparently it does conflict here.

I think maybe it should be adjusted so the file isn't created on install but is still copied to the persist dir on uninstall if it exists? That way rclone will still check for other config files but newly created ones will be on the scoop managed folder.

However, I haven't tested if rclone will create one there by default if none exists. So it's possible I'm way off the mark here!

Let me know what you think about that :)

Erisa avatar Nov 10 '21 12:11 Erisa

I'll chime in with some input here. There are plenty of apps in the Main bucket whose default configuration files live in standard locations (like ~/.config or ~/AppData). I'm not entirely against removing the rclone.conf's persistence from the Scoop folder - if it is causing problems for our users then the change should be reverted.

rashil2000 avatar Nov 10 '21 12:11 rashil2000

Fine with me, didn't know it would have this impact and was just trying to solve an open issue when I first interacted with it

Erisa avatar Nov 10 '21 12:11 Erisa

default configuration files live in standard locations (like ~/.config or ~/AppData)

Here is my input. I aim to make as many apps in my computer portable as possible, so that when I transfer my setup to another computer, or when I have to reinstall the OS, I don't lose anything. The fact that some apps here store config in APPDATA is sad. But how many of them are due to the lack of support for portable config from the app itself?

Just did a bit search. rclone introduced the portable config with this commit, which is dated Apr 13 this year. The feature request was dated Oct last year. The rclone manifest is created way before, when there was no portable support from rclone.

So is the rule of thumb that once a manifest is introduced to the repo as non-portable, we can no longer change it to portable later when the app starts to support it? Because I can't think of a way to make the "non-portable to portable" change backward compatible for any app.

Personally, I use Scoop instead of Chocolatey or winget exactly because it encourages portable apps. I understand there are use case where non-portable is good and even necessary, but shouldn't Scoop make up its mind to support one paradigm and stick to it, instead of giving user inconsistent experience (some portable some not)? For this specific case, it's not like this change suddenly caused an use case to fail. All he needs to do is copy the file over. If he needs the file to appear in %XDG_CONFIG_HOME%, he can create OS link himself. It's not destructive.

CrendKing avatar Nov 10 '21 12:11 CrendKing

So is the rule of thumb that once a manifest is introduced to the repo as non-portable, we can no longer change it to portable later when the app starts to support it? Because I can't think of a way to make the "non-portable to portable" change backward compatible for any app.

There actually is a way. There have been instances where apps later became portable, and for those manifests, an elaborate migration script needed to be written (see https://github.com/ScoopInstaller/Extras/pull/7259). I was not aware the rclone thing will cause issues (I'm not a user of rclone), but when we do shift to a portable config, migration needs to be done.

rashil2000 avatar Nov 10 '21 13:11 rashil2000

Migration is possible, sure, but I thought OP does not want to migrate his current config file. He seems to want to have it in XDG_CONFIG_HOME.

If OP is OK to an automated migration, like the linked qbittorrent, we can work on it later after revert maybe?

I was not aware the rclone thing will cause issues

Again, I'm sorry if I did not explained the effect of the change clearly in the PR. If a revert is necessary based on your judgement, go for it. I'm just a bit worried of what happens to other apps with similar situation (introduced as non-portable, later possible to be portable).

CrendKing avatar Nov 10 '21 13:11 CrendKing

If one of the users of rclone can contribute a migration script, then reversion won't be required.

rashil2000 avatar Nov 10 '21 15:11 rashil2000

What's the requirement of that script? Is it basically

  1. Check location 2~5 from the config location list, in order, for existence of a "rclone.conf".
  2. If found, print some message in highlight color, then copy it to the app dir
  3. If multiple are found, I don't know, print message that only the first one is copied, the others are ignored, or maybe do a content merge (but could cripple the config due to conflict names)

Fortunately, I think rclone config does not have relative path in it, so it could be simpler than your qbittorent example.

CrendKing avatar Nov 11 '21 00:11 CrendKing

If multiple are found, then pick the first one according to the priority order (and print the path of it). Then you don't need to look in the next location.

rashil2000 avatar Nov 11 '21 06:11 rashil2000

Working on it.

CrendKing avatar Nov 11 '21 09:11 CrendKing

Great, thanks!

rashil2000 avatar Nov 11 '21 09:11 rashil2000

https://github.com/ScoopInstaller/Main/pull/2936

CrendKing avatar Nov 11 '21 12:11 CrendKing