Open tigran123 opened 7 years ago
Selinux is used in android. how this information helps i do not know.
Btw, rsync to a native (not on sd) filesystem (e.g. a subdirectory of $HOME) is working fine on Android 7. So, it is just the vfat (or whatever --- Android's own "flavour" thereof) that is not working.
@its-pointless Yes, yes, I know. My replic was almost rhetorical --- I know this very well as I've been following all the NSA's clandestine work since 1990s and see how the things which they boldly announce on conferences as "purely theoretical suggestions" to "improve security" (but actually to provide mechanisms for spying on people in order to learn how to brainwash them most efficiently) all get invariably implemented by the actual software providers, one by one, thus removing all our freedoms and "convincing" us that it is ok to spy upon every thing that we do.
Yes, the problem persists (just as one would expect) when connected via USB with adb port forwarding.
So, we need to find an rsync option which deletes the target file before trying to rename it.... I've tried all --delete-blah
options and none of them help (they shouldn't as the manual clearly says they are for something completely different). Rsync command relies on the Unix permission mechanism (and rightly so) and the fools at (insert the manufacturer name here, any will do) bow down to NSA's demands and violate this perfect mechanism (and perfection cannot be further perfected, so why modify what worked fine for many generations?).
So, what do we do now? I will need to begin to actually think rather than keep complaining :)
Ok, found a workaround: instead of doing rsync in a single step, perform two steps:
It looks like this:
$ rsync -b --suffix '.bak' --delete --size-only -rvW . localhost:sd/Books/
sending incremental file list
Religions/Bible/Hebrew/The-Little-Book.pdf
sent 851,305 bytes received 2,220 bytes 243,864.29 bytes/sec
total size is 53,095,519,000 speedup is 62,207.34
$ rsync --delete --size-only -rvW . localhost:sd/Books/
sending incremental file list
deleting Religions/Bible/Hebrew/The-Little-Book.pdf.bak
sent 700,081 bytes received 2,245 bytes 156,072.44 bytes/sec
total size is 53,095,519,000 speedup is 75,599.53
Does anyone have a better idea?
$ mv new tnk.pdf mv: cannot move 'new' to 'tnk.pdf': Permission denied
@tigran123 Hm, are you able to rm tnk.pdf
? Or do you get permission denied for moving a file over another for every file on the sd, but otherwise you can delete it? I can't reproduce that on an Android 7.1 device here.
Yes, I can rm tnk.pdf
, look:
$ l tnk.pdf
-rwxr-x--- 1 u0_a116 everybody 8080229 Mar 6 14:00 tnk.pdf
$ pwd
/data/data/com.termux/files/home/sd/Books/Religions/Bible/Hebrew
$ rm tnk.pdf
$ l tnk.pdf
ls: cannot access 'tnk.pdf': No such file or directory
$ u
Linux localhost 3.18.35 #14 SMP PREEMPT Mon Jan 23 18:24:13 CST 2017 aarch64 Android
$ id
uid=10116(u0_a116) gid=10116(u0_a116) groups=10116(u0_a116)
$ l -d .
drwxr-x--- 5 u0_a116 everybody 32768 Mar 7 09:29 .
@tigran123 Are you able to reproduce the issue without using rsync? That is, can you try writing step-by-step instructions for how one could try reproducing the issue from scratch?
@fornwall Yes, of course, I have done exactly what you suggest in the very first post. I even provided the terminal session transcript of those instructions. Basically, just go to any directory, create a new file and try to "mv newfile existingfile" --- that is all there is to it. Previously this worked absolutely fine and still works on the internal properly Linux-y filesystems like where $HOME is located, but not on the external microsd card.
This issue/PR 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.
Is this issue still relevant?
This is quite a critical issue, because I rely on Termux to provide synchronoisation of all my major databases (200GB+) between desktop and mobile.
On Android 5.1.1 everything is working fine, just as before.
But on Android 7 I get these problems:
Now, let's see if the file was actually transferred:
No, as you see, the checksums do not match, so the file was not transferred.
Now, let's login to the mobile and check the permissions manually:
So, as you see, I can create and remove files, but cannot move them to an existing file, for some reason. But the Unix permission on the parent directory is 0750 and the uid is the same as my uid (and that of the sshd process). So, why doesn't it allow me to rename the file?
I hope Android is not using something stupid like ACL or (even worse!) this nonsense called "selinux" and is relying on the old good (almost venerable --- I could even say "sacred" if I wasn't afraid to be labeled an idol-worshipper) Unix permission mechanism as designed in 1970s... Or is something changed between 1970s and now, especially since Android 7?
I'll see if the problem persists via adb port forwarding and ssh to localhost... I hope not.