Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make backup folder changeable #12154

Closed
wants to merge 4 commits into from

Conversation

Roghetti
Copy link

First time contributor checklist

Contributor checklist

  • Virtual Device, Android 11
  • Virtual Device, Android 12
  • Virtual Device, Android 12.1
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

When you enable backups, you can choose a backup folder (since Android 10). You also get a freshly generated passphrase. But when you want to change your backup folder, currently you have to turn backups off and on again. There is no other way to choose a different folder. This comes with the downside that you also get a new passphrase. This Pull Request makes the displayed folder name clickable so you can choose another backup folder. Not moving or removing the current backup can be seen as a feature, the user keeps the copy of the backup (probably on another storage device). The user can move or remove the old backup files manually.

Copy link
Contributor

@cody-signal cody-signal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the size backups can grow to, I don't think we consider leaving it in the old directory as a feature. Please update the PR to warn the user and remove the backups before switching, or move them to the new location as they are technically still valid.

Additionally if you could see if we can release our permission claims on the old directory so we don't hold onto access we no longer need that would be great too (if you aren't already).

@Roghetti
Copy link
Author

Roghetti commented May 2, 2022

Sure, I can move the old backups to the new location.

Removing the permission for the old backup folder is a good idea, I’ll see if that’s possible and do that if it is.

Could you have a look at my other Pull Request (#11900) again, which is about chunking backups. This is even more pressing for us. With this PR (12154) alone, we would be able to switch online to a backup folder to SD cards, but it wouldn’t help us a lot, as it doesn’t allow files > 4GB.

Thank you :)

@Roghetti Roghetti marked this pull request as draft May 9, 2022 11:30
@Roghetti Roghetti force-pushed the backup-folder-selection branch 2 times, most recently from 6cd60b5 to 79a9556 Compare May 31, 2022 10:14
@Roghetti Roghetti marked this pull request as ready for review May 31, 2022 10:19
@Roghetti
Copy link
Author

Sorry for the, bit longer, interruption. Now the Pull Request should be ready to be merged. Permissions for the old backup directory are dropped when it is changed. Besides that, it is tried to move the backups to the new location, which also has some error handling, of course.

@Roghetti Roghetti requested a review from cody-signal June 1, 2022 10:02
@stale
Copy link

stale bot commented Jul 31, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 31, 2022
@cody-signal cody-signal self-assigned this Aug 1, 2022
@newhinton
Copy link
Contributor

I know i am highjacking this PR, but to me this is now getting rather urgent. My signal now takes up 4GB of storage for the app alone, with a tendency to increase by 70-100mb per month.

That means for the backup-functionality to work, i need an additional 8GB of permanent storage for the two backups, AND a third 4Gb when signal creates the new archive. At peak, signal requires 16Gb! of internal storage. This is untenable, and getting worse by the month.

At the moment signal regularly crashes my Launcher when it starts filling the storage filling up to 100% and then failing&not cleaning up the tempfile.

I guess checking for available space and failing the backup before filling up the device is a seperate issue.

This PR would at least alleviate some of the issues i encounter, since i can just get a bigger SD card, or move it off device altogether.

I really hope that the backup functionality can get some love in the near future, because imho, the current implementation is very barebones and lacks many useful improvements, that many users could benefit from, making signal even better (and easier to backup)

@Goldmaster
Copy link
Contributor

This looks very useful and nice to see. The backups feature needs to be severely improved on. There's nothing worse than losing chat history.

@cody-signal
Copy link
Contributor

It's something we're tracking internally, but I'm not sure when we'll get back to this. In a dire emergency, you can technically change the directory by disabling backups and re-enabling it and picking a new directory. This has the additional unfortunate impact of making a new passphrase so make sure to record it if you do this.

@stale
Copy link

stale bot commented Jan 6, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 6, 2023
@stale
Copy link

stale bot commented Jan 13, 2023

This issue has been closed due to inactivity.

@stale stale bot closed this Jan 13, 2023
@olof-nord
Copy link

olof-nord commented May 19, 2023

This is something which I would love to see as well. My backup file is growing in size and now I do not have enough space on my device left. Being able to specify backups on an external storage rather then internal would be a game changer

@Goldmaster
Copy link
Contributor

Can this be reopened, please?

@navid-zamani
Copy link

A simple solution from the wise old men of Unix is, to just make the directory that Signal backs up to a softlink to somewhere else.

E.g. via adb shell just go

cd /sdcard
mv Signal MyNewPath
ln -s MyNewPath Signal

At least if Google isn’t doing some of its psychopathic shenenigans again. (In that case: Go back to being a person: Get root. :)

@Keisial
Copy link

Keisial commented Nov 12, 2023

I detected this missing functionality and I am glad someone had actually coded it, @Roghetti!

Looking at the PR, it seems quite straightforward, but I have a couple of comments:

It moves the old backups by doing a copy+delete. While I'm not an android developer... isn't there a rename() that could be done? A copy+delete fallback might still be needed (e.g. old or new folder is on sdcard but the other isn't) but if both folders are on the same filesystem, a real rename() would be the right primitive.

It also seems that you call a onPartialSuccess() callback if some backups moved and others didn't, but it is not used (e.g. to show a message to the user saying that not all backups moved and they will need to move them manually)

@lp35
Copy link

lp35 commented Apr 19, 2024

It's something we're tracking internally, but I'm not sure when we'll get back to this. In a dire emergency, you can technically change the directory by disabling backups and re-enabling it and picking a new directory. This has the additional unfortunate impact of making a new passphrase so make sure to record it if you do this.

Backup is one of the most important things for an app like Signal. The workaround is NOT reliable at all, and FORCE the user to change and backup its passphrase for every backup file. Do you have any news on the internal tracking of this request?

@Roghetti gave its spare time to improve this functionnality. I personnaly backup signal over Webdav using Davx5, and sometime I need to remove the mount and make it again. Signal is not able to reuse the same folder after that. This feature is a MUST HAVE for any proper backup.

Thanks for any effort you can put on this.

Regards!

@UserX404
Copy link

UserX404 commented Apr 19, 2024

@lp35
Sure Webdav isn't Nextcloud exclusive, but if you'r running a NC you could use NC-App with auto upload of custom folder. I'm running this setup for several years now. Actually the team is enhancing/expanding backup functionality, so fingers crossed that also your issue get some love. ;-)

@lp35
Copy link

lp35 commented Apr 19, 2024

Sure Webdav isn't Nextcloud exclusive, but if you'r running a NC you could use NC-App with auto upload of custom folder. I'm running this setup for several years now. Actually the team is enhancing/expanding backup functionality, so fingers crossed that also your issue get some love. ;-)

That's great news thanks! Don't want to spoil the world with the new features, but will you offer a solution for self-hosted infras?

Regards

@navid-zamani
Copy link

Everyone, please remember that all of this is just very ugly hacks that should never be allowed to exist in the first place.

The correct, sane solution for a Unix-like operating system, which Android/Linux and iOS/BSD are under the hood, is to make a copy of the files that Signal uses. Not have each app implement its own backup system. That is already insanity.
You either make a snapshot of the file system or do it directly, but in any case, merely copy the files of Signal to a safe place, which is just a basic cp -a called from a trigger of your choice (like a cron job equivalent). While Signal has closed all files (aka is temporarily stopped) of course.

If you do not own/control your pocket computer (aka smartphone), as is the case with most smartphones by default and the whole point of the iPhone, then the owner decides, and you chose that, so boo hoo, how about: you become a person?!

In any case, both Android and iOS got built-in backup facilities. It’s just that the only backup provider they have built in is “the cloud”. Aka date hostage taking. Something at least the EU will probably soon change.

If you already have gone off the deep end, to complete looney land of pants-on-head insanity, and want to operate within the realms of that prison, then it’s a bit imprudent to then demand that some free app should enable your continued self-enslavement.
If you can apparently demand things so loudly, then go to your government and tell them you want a law that hands out 20 years of prison for lock-in schemes or whatever, and replace them if they do not comply, instead of this. You know… like a person.

For what it’s worth,
if you are not free to do any of this currently, but will at the first chance, then of course there is another temporary solution until then, as it is still a Unixy OS:
Make a softlink or bind mount to a mounted FUSE file system that internally does whatever pleases you. sshfs to a backup server, with a local cache, you name it.
On Android, there’s an insane re-implementation of that, called Storage Access Framework, and many things can offer SAF shares to other apps. Termux for example. You can even run a full virtual Linux in a virtual container, and offer SAF to that. Or run adb or sshfs to much of the local and external file systems.

I know, freedom scares the imprisoned mind, but the point is, that the principles are simple and emergent and you got the choice. Everything is a file. A backup is just a copy. Zero re-implementation of the wheel needed.

The idea of running Signal on a device that you don’t even have root to, but a hostile enemy (Google/Apple/…) does, is the pinnacle.of insanity anyway. Every OTA update of Android can do everything to make all the security of Signal pointless. It likely already is.

Maybe next time get a Fairphone…

You may.pitchfork me now.

— Consider me your Oxymoinsdanus, destroyer of bullshit. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

9 participants