Closed
Bug 820989
Opened 13 years ago
Closed 8 years ago
mozdevice: should be able to ls a file path
Categories
(Testing :: Mozbase, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: mcote, Assigned: mihneadb)
References
Details
Attachments
(1 file)
|
553 bytes,
patch
|
mcote
:
review-
|
Details | Diff | Splinter Review |
If you use the ls command on the terminal and provide a path to a file (as opposed to a directory), you get "##AGENT-WARNING## <path> is not a directory". I find this particularly weird with dmcli, which attempts to emulate shell commands, since from bash it's totally acceptable to ls a file path. It's a good way to determine if a file exists.
| Assignee | ||
Comment 1•13 years ago
|
||
I think the problem is the fact that in fact 'ls' is mapped onto the listFiles method, which is thought as it would only act on directories - actually, in dmSUT it actually cd's in there and then calls ls.
What do you think about adding a fileExists method in dmcli?
| Reporter | ||
Comment 2•13 years ago
|
||
Actually there is a fileExists() method already. I just thought it would be nice to support "ls" on a file specifically from dmcli.
Comment 3•13 years ago
|
||
I agree. No harm in adding a bit of logic into dmcli to do this. No one said it had to map exactly the devicemanager interface. :)
| Assignee | ||
Comment 4•13 years ago
|
||
Ok.
Assignee: nobody → mihneadb
Attachment #744887 -
Flags: review?(wlachance)
Attachment #744887 -
Flags: review?(mcote)
| Reporter | ||
Comment 5•13 years ago
|
||
Comment on attachment 744887 [details] [diff] [review]
make dmcli ls work on files
Review of attachment 744887 [details] [diff] [review]:
-----------------------------------------------------------------
Did you fully test this? On my system, I now get an exception if the argument is a directory or does not exist.
It turns out that this is actually due to a bug in fileExists(), which I have filed as bug 868505 (see there for the full exception traceback). However I can't approve this patch without that bug being solved, as it would cause a regression in behaviour by having "ls" not work on directories anymore. Feel free to ask for a rereview once that bug is fixed (which you can also do, if you like) and you have fully tested this patch.
Attachment #744887 -
Flags: review?(mcote) → review-
| Reporter | ||
Comment 6•13 years ago
|
||
Also, if the result of fileExists() is False, the function can just return an empty list right away. No point in the subsequent call to listFiles() in this case.
| Assignee | ||
Comment 7•13 years ago
|
||
(In reply to Mark Côté ( :mcote ) from comment #6)
> Also, if the result of fileExists() is False, the function can just return
> an empty list right away. No point in the subsequent call to listFiles() in
> this case.
Sorry, not sure what you mean. Are you talking about listfiles in dmcli? Because the patch does that (line 280).
Comment 8•13 years ago
|
||
Comment on attachment 744887 [details] [diff] [review]
make dmcli ls work on files
Unflagging myself for review here, looks like mcote has this one.
Attachment #744887 -
Flags: review?(wlachance)
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•