L. D. James
L. D. James

Reputation: 1719

Eclipse - Why Errors with Android SDK for normal user but not root?

Why doesn’t this error happening when starting Eclipse as a normal user, but doesn’t when starting as sudo:

enter image description here

I have checked the permission of all directories that I can imagine that might be affected and chowned to my user and group id.

These are the root directories of all areas that I’m familiar with:

Folder                   Specification
-------------------------------------------------------------
/opt/android/sdk          Android SDK
/opt/eclipse/eclipse      Eclipse
~/myeclipse               Eclipse specific configuration area
~/workspace               Source workspace

These are the commands that were issues to ensure that My user and group ID are assigned:

$ sudo chown -R ljames:ljames /opt/android/sdk
$ sudo chown -R ljames:ljames /opt/eclipse/eclipse
$ sudo chown -R ljames:ljames ~/myeclipse
$ sudo chown -R ljames:ljames ~/workspace

Can someone tell me what else might be causing this possible permission issue?

I also executed this command on all the subdirectories to find any file or directory not belonging to my user ID.

$ sudo find /opt/android/sdk ! -user ljames 
$ sudo find /opt/eclipse/eclipse ! -user ljames 
$ sudo find ~/myeclipse ! -user ljames 
$ sudo find ~/workspace ! -user ljames 

Upvotes: 1

Views: 44

Answers (1)

Bruce David Wilner
Bruce David Wilner

Reputation: 467

Clearly, this is a permissions problem. Root is not troubled by permissions; others are. Actually, there's one exception: at least one execute bit S_IXUSR|S_IXGRP|S_IXOTH in the permissions field ( di_flags & ~(S_IFMT) ) must be on for users--EVEN ROOT--to execute a program. This used to be true for "executing" (viz., searching) a directory, but no longer is. Note that I parenthesized S_IFMT because one should always be ultra-defensive when incorporating macros in expressions: they can be a source of obscure bugs.

I suspect the problem might be something that's superficially subtle but really isn't if you know how directory permissions work. I would be willing to BET MONEY that some directory somewhere is SEARCHABLE to your non-root programmer but is not READABLE. The difference is that "search" enables you to locate an entry of known name within a directory, whereas "read" enables you to browse the directory like an open catalog. In order to discover whole sets of files, say, *.java, that can be scanned sequentially for, say, the body of a given function, the containing directory must be READable as well as SEARCHable.

Upvotes: 1

Related Questions