Infeasible
Status Update
Comments
jb...@google.com <jb...@google.com> #2
Are you trying to use it on the SD card? The SD card is configured to not allow
modifying timestamps.
modifying timestamps.
me...@gmail.com <me...@gmail.com> #3
Yes, it is on the SD card. Why is the SD card configured to not allow modifying
timestamps? Is this in the documentation somewhere?
timestamps? Is this in the documentation somewhere?
jb...@google.com <jb...@google.com> #4
I don't know the reason why. Could you file a separate issue to have the
documentation updated? Thanks.
documentation updated? Thanks.
[Deleted User] <[Deleted User]> #5
I see this on a "cupcake" device:
% adb shell mount
[...]
/dev/block//vold/179:1 /sdcard vfat
rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,utf8
0 0
Note the "allow_utime" value. From an ubuntu man page found via google:
allow_utime=value
This option controls the permission check of mtime/atime.
20 If current process is in group of file's group ID, you
can change timestamp.
2 Other users can change timestamp.
The default is set from `dmask' option. (If the directory is
writable, utime(2) is also allowed. I.e. ~dmask & 022)
Normally utime(2) checks current process is owner of the file,
or it has CAP_FOWNER capability. But FAT filesystem doesn't
have uid/gid on disk, so normal check is too unflexible. With
this option you can relax it.
It looks like the mount options should *relax* the restriction, but I'm not really
sure how to interpret this. I haven't checked the flags on a production device
(don't have one handy).
% adb shell mount
[...]
/dev/block//vold/179:1 /sdcard vfat
rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,utf8
0 0
Note the "allow_utime" value. From an ubuntu man page found via google:
allow_utime=value
This option controls the permission check of mtime/atime.
20 If current process is in group of file's group ID, you
can change timestamp.
2 Other users can change timestamp.
The default is set from `dmask' option. (If the directory is
writable, utime(2) is also allowed. I.e. ~dmask & 022)
Normally utime(2) checks current process is owner of the file,
or it has CAP_FOWNER capability. But FAT filesystem doesn't
have uid/gid on disk, so normal check is too unflexible. With
this option you can relax it.
It looks like the mount options should *relax* the restriction, but I'm not really
sure how to interpret this. I haven't checked the flags on a production device
(don't have one handy).
me...@gmail.com <me...@gmail.com> #6
Here's what I get from my G1. There is no allow_utime option set.
kevin@saturn$ ./adb -d shell mount
....
/dev/block/mmcblk0p1 /sdcard vfat
rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,codepage=cp437,iocharset=iso8859-1,utf8
0 0
kevin@saturn$ ./adb -d shell mount
....
/dev/block/mmcblk0p1 /sdcard vfat
rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000,fmask=0711,dmask=0700,codepage=cp437,iocharset=iso8859-1,utf8
0 0
an...@gmail.com <an...@gmail.com> #7
This is a REALLY annoying bug, because it affects various programs I tested, like unzip tools, ftp transfer et cetera.
And "status declined"? I am not amused. But maybe the Cyanogen specialists can something do about it.
And "status declined"? I am not amused. But maybe the Cyanogen specialists can something do about it.
op...@gmail.com <op...@gmail.com> #8
I think maybe is permission problem of APP. Can others try and check whether my solution worked? Or ONLY my phone worked.
Thanks.
I program one download file APP and find the problem when I try modify downloaded file timestamp. I find touch command do not work by Runtime.getRuntime().exec(). In getFilesDir() the setLastModified worked. Then try mv command. I find mv command do not work by Runtime.getRuntime().exec() when from getFilesDir() to Environment.DIRECTORY_DOWNLOADS. So I think this maybe permission problem. My Redmi Note 3 give me android.permission.WRITE_EXTERNAL_STORAGE is USB write and read right. I try download file to getExternalCacheDir(). And the setLastModified worked. Then I mv the file to Environment.DIRECTORY_DOWNLOADS. The timestamp keeped!!!
My code like:
String download = ...getApplicationContext().getExternalCacheDir().getAbsolutePath() + File.separator + download_file_name;
File file = new File(download);
file.setLastModified(lastModified);
StringBuilder cmdline = new StringBuilder("mv ");
cmdline.append(download);
cmdline.append(" ");
download = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + File.separator + download_file_name;
cmdline.append(download);
Process process = Runtime.getRuntime().exec(cmdline.toString());
process.waitFor();
Thanks.
I program one download file APP and find the problem when I try modify downloaded file timestamp. I find touch command do not work by Runtime.getRuntime().exec(). In getFilesDir() the setLastModified worked. Then try mv command. I find mv command do not work by Runtime.getRuntime().exec() when from getFilesDir() to Environment.DIRECTORY_DOWNLOADS. So I think this maybe permission problem. My Redmi Note 3 give me android.permission.WRITE_EXTERNAL_STORAGE is USB write and read right. I try download file to getExternalCacheDir(). And the setLastModified worked. Then I mv the file to Environment.DIRECTORY_DOWNLOADS. The timestamp keeped!!!
My code like:
String download = ...getApplicationContext().getExternalCacheDir().getAbsolutePath() + File.separator + download_file_name;
File file = new File(download);
file.setLastModified(lastModified);
StringBuilder cmdline = new StringBuilder("mv ");
cmdline.append(download);
cmdline.append(" ");
download = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + File.separator + download_file_name;
cmdline.append(download);
Process process = Runtime.getRuntime().exec(cmdline.toString());
process.waitFor();
wi...@gmail.com <wi...@gmail.com> #9
ag...@gmail.com <ag...@gmail.com> #10
Please fix this bug; it's in Android for 10 years! It's a really annoying bug that messes up all timestamps. This can look pretty minor but those timestamps are used by other apps. As a consequence photos are sorted randomly and my backup program that relies on file timestamp (in the quick backup method) now wants to backup all my files.
Description
always returns false and does not update the time stamp.
Also, the documentation for setLastModified is wrong. It should return a
boolean.
Sample Code:
public void testTime() {
Log.d(TAG,"Testing setLastModified");
try {
long time = new Date().getTime() - 10000;
java.io.File f = new File("/sdcard/timetest");
boolean r = f.createNewFile();
Log.d(TAG,"r1:"+r+" mtime:"+f.lastModified());
Log.d(TAG,"time:"+time);
r = f.setLastModified(time);
Log.d(TAG,"r2:"+r+" mtime:"+f.lastModified());
} catch (Exception e) {
e.printStackTrace();
}
}