Monolingual icon indicating copy to clipboard operation
Monolingual copied to clipboard

Moving language files to root's trash is problematic

Open SeanMSmith opened this issue 8 years ago • 1 comments

I've been in the habit of running Monolingual with the "Move language files to trash" preference selected.

Today I noticed that I had 4 GB of .lproj folders sitting in /var/root/.Trash, which Monolingual had moved there instead of to ~/.Trash (presumably because of permissions issues)!

Had it not been for Monolingual 1.7.6's UI inadvertently reporting files removed from /var/root/.Trash rather than from their original locations (see https://github.com/IngmarStein/Monolingual/issues/106), I would never have known they were there, invisibly taking up disk space that Monolingual was designed to free.

In some scenarios, a very high percentage of files gets moved to root's trash instead of the user's: .e.g. 1.4 GB out of 1.6 GB in my run of Monolingual 1.7.6 two days ago.

This presents two obvious problems:

  1. If the user never notices the language files in root's trash, they may consume several GB of disk space indefinitely.

  2. Even if the user is made aware of the presence of language files in root's trash, emptying root's trash requires not only using the Terminal (with which the average user will not feel comfortable), but using the Terminal with sudo (which, of course, can be dangerous).

(To illustrate the difficulty of point 2 above, I was advised to enter sudo rm -rf /var/root/.Trash/*, but it turns out that this does nothing. I resorted to sudo rm -rf /var/root/.Trash/, which not only successfully emptied root's trash, but also removed root's trash directory itself. I then enabled the root user (following Apple's procedure at https://support.apple.com/en-us/HT204012) and logged in as root in the hope that this would recreate root's trash, but whatever trash it created was not /var/root/.Trash, which was still missing. Finally (after logging out of root and disabling the root user) I recreated root's trash via sudo mkdir -m 700 /var/root/.Trash, but I have no idea whether there was an Access Control List associated with that directory, and if so, what has happened to it, as ACLs are beyond my modest knowledge. I hope I haven't broken anything.)

What should be done? At the very least, I would suggest some warning in the UI and in the ReadMe that moving language files to trash may result in many language files being moved to root's trash instead of the user's, where they will remain undeleted without use of the Terminal.

Perhaps another solution will occur to you.

SeanMSmith avatar Feb 10 '17 06:02 SeanMSmith

You're absolutely right that this is problematic. Most users won't see root's trash at all. It is currently implemented this way just to avoid changing permissions so that the files can be moved to the user's trash.

A proposed solution would be to change the owner to the current user and add write permissions to all affected directories so that the trashing operation is likely to succeed.

IngmarStein avatar Feb 12 '17 10:02 IngmarStein