isDir doesn't work properly on Android 4.1

RESOLVED FIXED in mozilla17

Status

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: wlach, Assigned: wlach)

Tracking

Trunk
mozilla17
x86_64
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

In Android 4.1, doing:

ls -a /mnt/sdcard

Will return `/mnt/sdcard` (i.e. it will return the directory, not the contents of the directory). In older versions of Android, by contrast `ls -a /mnt/sdcard` will return nothing. This seems to be because 4.1 doesn't dereference symbolic links when doing ls -a (and /mnt/sdcard is a symlink)

I think the easiest solution to this is just to postpend a '/' to the name of the file we're trying to determine is a directory. If it is a directory (whether or not we've symlinked to it), ls -a will give something sensible (either the contents or the name). If it isn't, then we'll return an error. Perfect.
(In reply to William Lachance (:wlach) from comment #0)

> Will return `/mnt/sdcard` (i.e. it will return the directory, not the
> contents of the directory). In older versions of Android, by contrast `ls -a
> /mnt/sdcard` will return nothing. This seems to be because 4.1 doesn't
> dereference symbolic links when doing ls -a (and /mnt/sdcard is a symlink)

Actually this is slightly wrong. No version of android will dereference symbolic links. It's just that /mnt/sdcard only *became* a symbolic link in 4.1. Whee!
Comment on attachment 654660 [details] [diff] [review]
Fix devicemanagerADB's isDir to handle symbolic links properly

Review of attachment 654660 [details] [diff] [review]:
-----------------------------------------------------------------

nice little patch, thanks.
Attachment #654660 - Flags: review?(jmaher) → review+
https://hg.mozilla.org/mozilla-central/rev/e53c57998350
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in before you can comment on or make changes to this bug.