Trash should be default remove behavior

there already is one, with that it is easy :wink: batch.scripts/deleteJS.bat at master · npocmaka/batch.scripts · GitHub (edit: well looks like JScript but can be used from a normal batch script^^)

Actually, even better, I propose:

  • Create a new versioning scheme called “System Trashcan”. This scheme simply moves files to the system trashcan, using the platform specific methods to make this integrate seamlessly.
  • Default to this versioning scheme on platforms where it exists - Mac OS X and Windows, at least initially.
  • Don’t touch the existing Trashcan scheme (except possibly renaming or clarifying the relation to the new scheme).
  • Don’t change the default on platforms that don’t have a System Trashcan scheme.

I bet a lot of people have found nice use cases for the existing Trashcan scheme on Windows and Mac and don’t want it removed. That’s usually what you find out when you remove a feature. :slight_smile:

5 Likes

Thanks for revisiting the idea of having a default trash. My suggestion is to keep things inside the Syncthing “universe”

  • enable trash can versioning by default
  • add little trash can icon for each folder in web gui if folder has files in .stversions
  • on click show list of files
  • make it possible to “restore” (= download) these files via browser (this would allow to do things remotely as well)
  • show path of .stversions to user (for larger operations, AFAIK it is not possible to open a folder per click e.g. in Windows Explorer?)

I dont think you are right. Linux must be divided into “server” systems and desktop systems. The desktop systems offer with The FreeDesktop.org Trash specification a possibility for a trash can. The “server” systems should be treated with “delete directly”.

1 Like

Which systems follow this standard, and how do we tell?

This is on my ubuntu 15.10 machine:

`$ env | sort | grep ^XDG

XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/usr/share/upstart/xdg:/etc/xdg:/etc/xdg XDG_CURRENT_DESKTOP=XFCE XDG_DATA_DIRS=/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share/:/usr/share/:/usr/share XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/lars XDG_MENU_PREFIX=xfce- XDG_RUNTIME_DIR=/run/user/1000 XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 XDG_SEAT=seat0 XDG_SESSION_DESKTOP=xubuntu XDG_SESSION_ID=c2 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 XDG_SESSION_TYPE=x11 XDG_VTNR=7`

this is knoppix v6.7 from 2011

fedora 23

I currently dont know how to retrieve a list of distros.

I’m not sure what you’re saying, though. Is any of these variables indicative of the fact that we should use a trash folder?

Sry, to few words too late in the evening.

XDG has a trash spec. And these environment variables indicate a XDG desktop session is running. So we only need the path to the trash. I just try to figure out on my local system.

I just thought about determining the strategy and would say skip that for linux and directly delete until user feedback ask for better support. I think it will be kind of flaky detection. Sry for the spam :expressionless:.

1 Like

This is really what I was getting at in my post earlier. While I love the standard trash on my desktop linux systems, checking for all of the implementations is not realistic for ST.

Let’s make delete the default behaviour on Linux and add an example of using trash-cli in the custom versioning doc.

Here’s a question I posted in the PR, but for a wider audience:

We trash (“version”, currently) files when they’re overwritten and replaced as well as deleted.

Does it make sense to have something that claims to be the “system standard” way of using a trashcan / recycle bin and have it put copies of files in the trash on every modification? Does anyone else do this?

If not, what we would implement here would be something entirely different from the “usual” versioning schemes that we already have.

1 Like

Check send2trash python library, it already deals with all this linux env var madness, and works out if there is a trash can or not, and where it is.

Good point. This is different to the trash can versioning and isn’t a drop in replacement.

The thing is that that freedesktop “specification” (yes, scare quotes because I think it’s fairly crap) assumes a desktop environment. The env var parsing thing isn’t too tricky - it’s basically just use $XDG_DATA_HOME/Trash or look for a top level trash. But the spec also says that $XDG_DATA_HOME defaults to ~/.local/share when unset. The python library you link seems to implement this.

For our purposes this means that if we are to follow the spec, we should always trash files to somewhere like ~/.local/share/Trash even when finding no environment variables at all set anywhere. This is what I’m very subtly hinting at in

because as far as I understand we can’t and I have seen no indications that the freedesktop “standard” (yes there I go again) is wide spread enough that we should assume it’s in effect on all unixy systems.

At the very most I could possibly imagine doing the trash thing if and only if $XDG_DATA_HOME is set…

2 Likes

I have my Syncthing clients set up to always save multiple backups for every file, so I’m not in any danger here. But I strongly agree that supporting the system trash can, or some similar solution, is important. For every system.

There’s been a trash can in every Linux desktop environment I’ve ever used, and I’ve tinkered with a lot of them. I would not say that “delete a file and it’s gone forever” is the expectation at all. Maybe in a headless system only running as a server – but still, having some way to un-delete enabled by default on all systems would be good. If testing to see whether the client computer actually has a Trash folder is too complicated, then at least put the files in the usual .stversions directory for some amount of time.

Thanks.

I bet a lot of people have found nice use cases for the existing Trashcan scheme on Windows and Mac and don’t want it removed. That’s usually what you find out when you remove a feature. :slight_smile:

That’s a really good idea!

(Relevant xkcd:

)

3 Likes

Are the .stversions folders replicated among machines?

I have setup simple file versioning on my largest server instance, and not on the others.

We use netatalk/OSX Finder, that means zilch network trash. So if a user on a satellite node deletes a file, it lands in .stversions on the large server. But if the deletion happens on the instance that runs the versioning config, then the file is gone.

In addition, having a remote trash can is kind of counter-intuitive (and impractical) when you want to just “undo” your mistake.

Why not a visible directory, say Sync-Journal, synched automatically among peers, that would hold local files or remote pointers to files that were modified/deleted? And mandate at least 2 nodes with the same file versioning setting, in order to receive and store all deleted files, even when the OS doesn’t offer a trashcan facility?

Makes no sense? Just say so :wink:

.stversions is not shared among all nodes.

What you are suggesting could be implemented in a custom version scheme but I don’t think it fits into the scope of vanilla Syncthing. Happy to be corrected if one of the main devs disagree.

You have to consider how many conflicts can be caused by a couple of changes on multiple clients and how this conflict files could conflict with each other if they were synced.

Have a look at @lkwg82 post. It seems that $XDG_DATA_HOME isn’t set. But $XDG_CURRENT_DESKTOP in ["GNOME", "LXDE", ...] should work for most users :slight_smile:

1 Like