Issue Details (XML | Word | Printable)

Key: HADOOP-6272
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Urko Benito
Votes: 0
Watchers: 9
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Incorrect UserName at Solaris because it has no "whoami" command by default

Created: 27/Jul/09 05:39 PM   Updated: 28/Sep/09 11:36 PM
Return to search
Component/s: security, util
Affects Version/s: 0.20.1, 0.21.0
Fix Version/s: None

Time Tracking:
Original Estimate: 24h
Original Estimate - 24h
Remaining Estimate: 24h
Remaining Estimate - 24h
Time Spent: Not Specified
Remaining Estimate - 24h

File Attachments:
  Size
File Licensed for inclusion in ASF works PermissionChecker.java.diff 2009-07-29 01:39 PM Urko Benito 0.4 kB
File Licensed for inclusion in ASF works Shell.java.diff 2009-07-29 01:39 PM Urko Benito 1 kB
GZip Archive Licensed for inclusion in ASF works test-hadoop-security.tar.gz 2009-07-29 12:40 PM Urko Benito 4.98 MB
File Licensed for inclusion in ASF works UnixUserGroupInformation.java.diff 2009-07-29 01:39 PM Urko Benito 0.2 kB
Environment: OS: SunOS 5.10
Issue Links:
Reference
 


 Description  « Hide
Solaris enviroment has no _whoami_ command, so the _getUnixUserName()_ at UnixUserGroupInformation class fails because it's calling to Shell.USER_NAME_COMMAND which is defines as "whoami".
So it launched an Exception and set the default "DrWho" username ignoring all the FileSystem permissions.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
dhruba borthakur added a comment - 27/Jul/09 08:48 PM
Is it possible for you to find out the name of the equivalent command in Solaris? Better still, if you can submit a patch that incorates your findings, that will be great. Thanks.

Jeff Hammerbacher added a comment - 27/Jul/09 11:01 PM
I think "id -nu" is the correct command in Solaris.

Urko Benito added a comment - 28/Jul/09 07:48 AM
I'm working on a patch to solve this issue.

You're right, on Solaris is "id -un" but this command is at "/usr/xpg4/bin/id" this's a BSD style command. The "/usr/bin/id" command is a SRV style so it has only the "-a" and "-p" options

# uname -a
SunOS zion 5.10 Generic_138888-07 sun4u sparc SUNW,Sun-Fire-280R
# /usr/xpg4/bin/id -un
root
# /usr/xpg4/bin/id -Gn
root other bin sys adm uucp mail tty lp nuucp daemon

But the question is at UnixUserGroupInformation.java the method static String getUnixUserName() throws IOException calls to executeShellCommand( new String[]{Shell.USER_NAME_COMMAND}) but i think this can be rewrite to

static String getUnixUserName() throws IOException

Unknown macro: { return System.getProperty("user.name"); }

Or change the USER_NAME_COMMAND and getGROUPS_COMMAND

What do you think is better solution?


Tsz Wo (Nicholas), SZE added a comment - 28/Jul/09 06:00 PM
> Solaris enviroment has no whoami command ...
In this post, they said /usr/ucb/whoam is available in Solaris.

I suggest not to change the existing codes unless whoami is absolutely unavailable.


Tsz Wo (Nicholas), SZE added a comment - 28/Jul/09 06:03 PM
BTW, Hudson is using Solaris (see http://hudson.zones.apache.org/hudson/job/Hadoop-Patch/). So I guess the whoami command exists in Solaris.

Urko Benito added a comment - 29/Jul/09 12:34 PM
There're some issues and i'll try to explain what's happend onto Solaris.

1.- By default the Shell class calls to "whoami" without full path, this is a security risk

Here's the example

1.- Create a new directory onto Hadoop HDFS on Solaris 10 and set the user and group to *hadoop, then set the perm to 700 so, only hadoop user can read/write onto*

$ uname -a
SunOS sol10-enigma 5.10 Generic_139556-08 i86pc i386 i86pc
$ hadoop fs -mkdir testdir
$ hadoop fs -chown -R hadoop:hadoop testdir
$ hadoop fs -chmod 700 testdir
$ hadoop fs -lsr
drwx------ - hadoop hadoop 0 2009-07-29 13:43 /user/hadoop/testdir

2.- Now from another Sun Box try to run the sample application that i've attached ( test-hadoop-security.tar.gz ) this one has no whoami at path

$ uname -a
SunOS hedwig 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Fire-V490
$ id
uid=2011(postgres) gid=90(postgres)
$ /usr/xpg4/bin/id -Gn
postgres dba
$ /usr/xpg4/bin/id -un
postgres
$ which whoami
no whoami in /opt/apache-ant-1.7.1/bin /u01/app/postgres/8.4/db/bin/64 /u01/app/postgres/8.4/db/bin /usr/bin /usr/sfw/bin /usr/local/bin

3.- Run the Sample Application

$ cd TestHadoop/
$ ant
Buildfile: build.xml

init:
[mkdir] Created dir: /export/home/postgres/TestHadoop/build
[mkdir] Created dir: /export/home/postgres/TestHadoop/javadoc
[mkdir] Created dir: /export/home/postgres/TestHadoop/build.test

compile:
[javac] Compiling 1 source file to /export/home/postgres/TestHadoop/build
[javac] /export/home/postgres/TestHadoop/src/com/sfchildren/sbcore/backup/Main.java:89: warning: [deprecation] USER_NAME_COMMAND in org.apache.hadoop.util.Shell has been deprecated
[javac] String[] result = executeShellCommand( new String[]{Shell.USER_NAME_COMMAND});
[javac] ^
[javac] 1 warning

dist:
[mkdir] Created dir: /export/home/postgres/TestHadoop/dist
[jar] Building jar: /export/home/postgres/TestHadoop/dist/hadoop-example.jar

run:
[echo]
[echo] Test Hadoop Shell.USER_NAME without "whois" at path
[echo]
[echo] 1.- Test with original Hadoop-0.20.0-core.jar
[echo] 2.- Test with NEW Hadoop-0.20.1-core-dev.jar
[echo]
[echo] TestCase
[echo] - Create 3 directories "uno" "dos" "tres" at "/user/hadoop/testdir"
[echo] the "/user/hadoop/testdir" has the been created as bellow
[echo]
[echo] $ hadoop fs -mkdir testdir
[echo] $ hadoop fs -chown -R hadoop:hadoop testdir
[echo] $ hadoop fs -chmod 700 testdir
[echo] $ hadoop fs -lsr
[echo] drwx------ - hadoop hadoop 0 2009-07-29 13:24 /user/hadoop/testdir
[echo]
[echo] - Create 1 file onto directory
[echo]
[echo]
[echo]
[echo]
[echo]
[echo] Running with hadoop-0.20.0-core.jar
[echo]
[echo]
[java] Get UserName from System.getProperty: postgres
[java] Get UserName from Shell.USER_NAME_COMMAND Fail, Default User DrWho assigned
[java] 29-jul-2009 14:16:59 com.sfchildren.sbcore.backup.Main createTmpFile
[java] INFO: File testfile Created with Size: 772889 bytes Time: 1 seconds
[java] 29-jul-2009 14:17:04 com.sfchildren.sbcore.backup.Main createTmpFile
[java] INFO: File testfile Created with Size: 3592563 bytes Time: 4 seconds
[java] 29-jul-2009 14:17:20 com.sfchildren.sbcore.backup.Main createTmpFile
[java] INFO: File testfile Created with Size: 12417028 bytes Time: 16 seconds
[echo]
[echo]
[echo] Running With New Hadoop-0.20.1-dev-core
[echo]
[echo]
[java] Get UserName from System.getProperty: postgres
[java] Get UserName from Shell.USER_NAME_COMMAND Fail, Default User DrWho assigned
[java] Get UserName from Shell.getUSER_NAME_COMMAND() postgres
[java] Exception org.apache.hadoop.security.AccessControlException: Permission denied: user=postgres, access=EXECUTE, inode="testdir":hadoop:hadoop:rwx------

BUILD SUCCESSFUL
Total time: 27 seconds

as you can see, with the hadoop-0.20-core.jar the user is ignored, but with me hadoop-0.20.1-dev-core.jar the user and group is correct identified as postgres and group postgres and a AccessControlException is launched when try to access testdir

4.- Verify the HDFS structure now

$ hadoop fs -lsr
drwx------ - hadoop hadoop 0 2009-07-29 13:50 /user/hadoop/testdir
drwxr-xr-x - DrWho hadoop 0 2009-07-29 13:50 /user/hadoop/testdir/dos
rw-rr- 3 DrWho hadoop 3592563 2009-07-29 13:50 /user/hadoop/testdir/dos/testfile
drwxr-xr-x - DrWho hadoop 0 2009-07-29 13:50 /user/hadoop/testdir/tres
rw-rr- 3 DrWho hadoop 12417028 2009-07-29 13:50 /user/hadoop/testdir/tres/testfile
drwxr-xr-x - DrWho hadoop 0 2009-07-29 13:50 /user/hadoop/testdir/uno
rw-rr- 3 DrWho hadoop 772889 2009-07-29 13:50 /user/hadoop/testdir/uno/testfile

5.- The hdfs-site.xml i've defined the value dfs.permission.supergroup to hadoop as

<!-- SuperUser Group -->
<property>
<name>dfs.permissions.supergroup</name>
<value>hadoop</value>
<final>true</final>
</property>

But the user who launched the TestApp is postgres with groups postgres and dba no hadoop

The Second issue is if i make a "fake" of whois i can bypass the security layout as the above example

1.- At Hadoop Cluster clean and create the testdir
$ hadoop fs -rmr testdir
Deleted hdfs://namenode.hadoop.test.com:54310/user/hadoop/testdir
$ hadoop fs -mkdir testdir
$ hadoop fs -chown -R hadoop:hadoop testdir
$ hadoop fs -chmod 700 testdir
$ hadoop fs -lsr
drwx------ - hadoop hadoop 0 2009-07-29 14:02 /user/hadoop/testdir

2.- At the second SunBox try to make a whoami fake

$ uname -a
SunOS hedwig 5.10 Generic_127127-11 sun4u sparc SUNW,Sun-Fire-V490
$ which whoami
no whoami in /opt/apache-ant-1.7.1/bin /u01/app/postgres/8.4/db/bin/64 /u01/app/postgres/8.4/db/bin /usr/bin /usr/sfw/bin /usr/local/bin
$ echo "echo hadoop" > ~/whoami
$ chmod +x ~/whoami
$ export PATH=~:$PATH
$ which whoami
/export/home/postgres/whoami
$ whoami
hadoop
$ id
uid=2011(postgres) gid=90(postgres)

3.- Launch TestApp

$ cd TestHadoop/
$ ant
Buildfile: build.xml

init:

compile:

dist:

run:
[echo]
[echo] Test Hadoop Shell.USER_NAME without "whois" at path
[echo]
[echo] 1.- Test with original Hadoop-0.20.0-core.jar
[echo] 2.- Test with NEW Hadoop-0.20.1-core-dev.jar
[echo]
[echo] TestCase
[echo] - Create 3 directories "uno" "dos" "tres" at "/user/hadoop/testdir"
[echo] the "/user/hadoop/testdir" has the been created as bellow
[echo]
[echo] $ hadoop fs -mkdir testdir
[echo] $ hadoop fs -chown -R hadoop:hadoop testdir
[echo] $ hadoop fs -chmod 700 testdir
[echo] $ hadoop fs -lsr
[echo] drwx------ - hadoop hadoop 0 2009-07-29 13:24 /user/hadoop/testdir
[echo]
[echo] - Create 1 file onto directory
[echo]
[echo]
[echo]
[echo]
[echo]
[echo] Running with hadoop-0.20.0-core.jar
[echo]
[echo]
[java] Get UserName from System.getProperty: postgres
[java] Get UserName from Shell.USER_NAME_COMMAND hadoop
[java] 29-jul-2009 14:32:45 com.sfchildren.sbcore.backup.Main createTmpFile
[java] INFO: File testfile Created with Size: 4421872 bytes Time: 4 seconds
[java] 29-jul-2009 14:32:53 com.sfchildren.sbcore.backup.Main createTmpFile
[java] INFO: File testfile Created with Size: 7235384 bytes Time: 8 seconds
[java] 29-jul-2009 14:33:02 com.sfchildren.sbcore.backup.Main createTmpFile
[java] INFO: File testfile Created with Size: 5693610 bytes Time: 8 seconds
[echo]
[echo]
[echo] Running With New Hadoop-0.20.1-dev-core
[echo]
[echo]
[java] Get UserName from System.getProperty: postgres
[java] Get UserName from Shell.USER_NAME_COMMAND hadoop
[java] Get UserName from Shell.getUSER_NAME_COMMAND() postgres
[java] Exception org.apache.hadoop.security.AccessControlException: Permission denied: user=postgres, access=EXECUTE, inode="testdir":hadoop:hadoop:rwx------

BUILD SUCCESSFUL
Total time: 24 seconds

As you can see, now hadoop say that user is hadoop

4.- View HDFS files

$ hadoop fs -lsr
drwx------ - hadoop hadoop 0 2009-07-29 14:02 /user/hadoop/testdir
$ hadoop fs -lsr
drwx------ - hadoop hadoop 0 2009-07-29 14:06 /user/hadoop/testdir
drwxr-xr-x - hadoop hadoop 0 2009-07-29 14:06 /user/hadoop/testdir/dos
rw-rr- 3 hadoop hadoop 7235384 2009-07-29 14:06 /user/hadoop/testdir/dos/testfile
drwxr-xr-x - hadoop hadoop 0 2009-07-29 14:06 /user/hadoop/testdir/tres
rw-rr- 3 hadoop hadoop 5693610 2009-07-29 14:06 /user/hadoop/testdir/tres/testfile
drwxr-xr-x - hadoop hadoop 0 2009-07-29 14:06 /user/hadoop/testdir/uno
rw-rr- 3 hadoop hadoop 4421872 2009-07-29 14:06 /user/hadoop/testdir/uno/testfile

I think now it's more clear no?

I've attached some files to evaluate the new code.


Urko Benito added a comment - 29/Jul/09 12:40 PM
This's the sample application to test missing the whoami command at Solaris (and other)

Urko Benito made changes - 29/Jul/09 12:40 PM
Field Original Value New Value
Attachment test-hadoop-security.tar.gz [ 12414895 ]
Urko Benito added a comment - 29/Jul/09 01:39 PM
Diff for source files

Urko Benito made changes - 29/Jul/09 01:39 PM
Attachment Shell.java.diff [ 12414904 ]
Attachment UnixUserGroupInformation.java.diff [ 12414903 ]
Attachment PermissionChecker.java.diff [ 12414902 ]
Tsz Wo (Nicholas), SZE added a comment - 29/Jul/09 06:13 PM
Urko, first, thanks for testing in such great details.

You are totally correct about the security risks because the real security mechanism implementation is not completed yet (see HADOOP-4487). In order to provide permission checking in Namenode, etc., UnixUserGroupInformation simply greps the username and groups from the shell and then forwards them. We have an assumption that the whoami command is available in the OS.

Note that changing whoami to other commands does not really increase security since a malicious user can modify the codes to impersonate another user.


Urko Benito added a comment - 29/Jul/09 07:55 PM
Thanks Tsz Wo,

So what do you think about the patch? Do you think it's better to wait for HADOOP-4487 be solved or to apply the patch to the current version?


Tsz Wo (Nicholas), SZE added a comment - 29/Jul/09 08:41 PM
> So what do you think about the patch? Do you think it's better to wait for HADOOP-4487 be solved or to apply the patch to the current version?

The patch mainly changes the shell commands from whoami + groups to id and makes SunOS a special case. As mentioned before, it does not increase security. So we have to wait for HADOOP-4487 anyway.

The question is whether it is good to (1) replace whoami + groups with id and (2) make SunOS a special case. Both (1) and/or (2) are incompatible changes, i.e. it potentially breaks some existing systems. I think we should minimize incompatible changes in general.

Could you simply install whoami in your SunOS systems?

(BTW, you may use "svn diff > a.patch" or the corresponding comnand in git for generating patches.)


dhruba borthakur added a comment - 30/Jul/09 01:47 AM
One can install a whoami script on the solaris machine. It could be a shell script that internally uses the id command. In that case, no changes are needed to Hadoop. is my assumption correct?

Urko Benito added a comment - 30/Jul/09 11:16 AM
Hi

I think the solution is not to change the source code but, keep in mind that this is not the correct way (but until HADOOP-4487 is solved) i proposed a solution

  • Update the prerequisites at wiki page saying something like keep in mind whoami, bash and md5sum must be present and accesible to hadoop process
  • Add some Hadoop Solaris Installation Guide to the official doc

I'm writing a Installing Hadoop on Solaris Guide at my blog, but at the moment is in Spanish, i'll translated it to English and add to the issue.

What do you think about?


Tsz Wo (Nicholas), SZE added a comment - 30/Jul/09 06:35 PM
+1 on adding more documentation and wiki.

Tsz Wo (Nicholas), SZE made changes - 30/Jul/09 06:35 PM
Component/s build [ 12312925 ]
Component/s documentation [ 12312918 ]
Issue Type Bug [ 1 ] Improvement [ 4 ]
Allen Wittenauer added a comment - 28/Aug/09 10:47 PM
This is basically a duplicate of HADOOP-4603 which provides a very simple fix.

Tsz Wo (Nicholas), SZE made changes - 28/Aug/09 11:08 PM
Link This issue relates to HADOOP-4603 [ HADOOP-4603 ]
Tsz Wo (Nicholas), SZE added a comment - 28/Aug/09 11:08 PM
I would say this is related to but not duplicates HADOOP-4603 since HADOOP-4603 assumes /usr/ucb/whoami on Solaris.

Allen Wittenauer added a comment - 17/Sep/09 09:12 PM
From where I sit, this is what I see happening:

a) We are afraid of writing JNI code, even tho the JNI code that needs to be written should be highly portable since it is all POSIX stuff. HADOOP-4998

b) We are not willing to write special case OS code for determining what the user is and instead dependent upon user's hacking up their path in likely incompatible ways. [what this and other bugs are about]

c) We are willing to write special case OS code for dealing with memory management for the MapReduce framework. [See LinuxTaskController]

So we now have (essentially) two patches that may make the situation better. Would someone explain to me why either HADOOP-4603 or this one isn't getting committed?


Tsz Wo (Nicholas), SZE added a comment - 17/Sep/09 09:42 PM
> So we now have (essentially) two patches that may make the situation better. Would someone explain to me why either HADOOP-4603 or this one isn't getting committed?

The patch in HADOOP-4603 only add an absolute path to whoami. How does it make the situation is better?

On the other hand, if someone put their whoami in a different path, say /usr/bin/whoami. The patch will breaks their systems.


Allen Wittenauer added a comment - 17/Sep/09 09:44 PM
The part you don't understand is that Solaris ships with /usr/ucb/whoami as part of the base OS install.

Allen Wittenauer added a comment - 17/Sep/09 09:47 PM
Or, as an alternative, on Solaris, try path-less whoami, if it fails, try /usr/ucb/whoami specifically.

In either case, it is reprehensible that this still isn't fixed.


Tsz Wo (Nicholas), SZE added a comment - 17/Sep/09 09:54 PM
> The part you don't understand is that Solaris ships with /usr/ucb/whoami as part of the base OS install.

Are you sure that /usr/ucb/whoami exists in all versions of Solaris? How come Urko said that "Solaris enviroment has no whoami command, ..." in the description?

> Or, as an alternative, on Solaris, try path-less whoami, if it fails, try /usr/ucb/whoami specifically.

I won't object doing this since this is no longer incompatible.


Allen Wittenauer added a comment - 18/Sep/09 04:45 PM
The only versions that don't have /usr/ucb/whoami are Solaris 1.x aka SunOS 4.x. Perhaps a bit of (rough) history will help explain:

When the transition from BSD (Solaris 1.x) to SysV (Solaris 2.x) was made, there was a need to provide some backward compatibility. Given that whoami is BSD in origin, it was moved to /usr/ucb with the rest of the BSD-specific commands. [This is why /usr/bin/ps -ef (SysV) and /usr/ucb/ps auwwx (BSD) work the way they do). In addition, commands that had different semantics between SysV and POSIX were also shifted around. So if you want POSIX-style semantics for something like id, you need to use /usr/xpg4/bin/id or /usr/xpg6/bin/id .

The reality is, is that if we're going to keep this inane fork()'ing for the user and group information, the patch that uses id (and /usr/xpg4/bin/id on Solaris) is probably a better fix simply because it is easy to point to a spec that says "these command line options will provide this information". whoami, being BSD, has little-to-no such spec and is standard by defacto... but only BSD and systems that want to be compatible with it. [Linux being a kitchen sink sort of OS falls into the latter.]

That said, the only machines where /usr/ucb/whoami won't exist are those machines that don't install the BSD backward compat packages. Thus my comment on 'hardened' machines up above.


Tsz Wo (Nicholas), SZE added a comment - 18/Sep/09 06:11 PM
Allen, what is the problem on Solaris if we require the path-less whoami?

Allen Wittenauer added a comment - 18/Sep/09 07:34 PM
/usr/ucb commands have BSD-style semantics. Putting in the path will likely break user environments and potentially break Hadoop in other ways. For example, /usr/ucb/du, df, chown, etc have different semantics than their SysV brethren in /usr/bin. /usr/ucb/cc enables /usr/ucbinclude prior to /usr/include, etc, etc, etc. Putting /usr/ucb in the path is not recommended by Sun.

Tsz Wo (Nicholas), SZE added a comment - 18/Sep/09 08:00 PM
Could we use alias or create a symbolic link?

Allen Wittenauer added a comment - 18/Sep/09 08:04 PM
Why are you so against committing this patch when there is already OS specific code in the rest of the system? Look, fork()ing for identity is already a giant turd. This just makes the turd work on another OS without the user having to do anything. So, no, I don't believe asking for a symlink is reasonable when we could make it Just Work(tm) out of the box with little-to-no effort on our part. By the time we finish this conversation, either one of these patches could have been committed and tested.

Tsz Wo (Nicholas), SZE added a comment - 18/Sep/09 08:18 PM
> Why are you so against committing this patch when there is already OS specific code in the rest of the system? ...

Because we have to maintain such OS specific codes forever. Once the codes have got in, it is hardly to remove them because removing them becomes an incompatible change.

I do not know much details on LinuxTaskController and the use of fork(), the problems you mentioned previously. But if they are done by mistakes, they are not excuses to make more mistakes.


Todd Lipcon added a comment - 18/Sep/09 09:32 PM

Because we have to maintain such OS specific codes forever. Once the codes have got in, it is hardly to remove them because removing them becomes an incompatible change.

I agree with this sentiment about maintenance, but I don't see how this would be an incompatible change. The existence of a whoami executable is not something that's part of the API - the user assumes that most software will "just work". Calling out to "whoami" is a hack in the first place, and hopefully will be removed soon when true authentication support makes it into Hadoop.

+1 for fixing this, though I don't think the patch is so great. Can you format this as a proper single-file patch against the hadoop-common repository? I'll move this to the HADOOP JIRA since this is not HDFS-specific. See http://wiki.apache.org/hadoop/HowToContribute for information on how to format a patch to be committed.


Todd Lipcon made changes - 18/Sep/09 09:33 PM
Component/s documentation [ 12312918 ]
Component/s util [ 12310740 ]
Component/s security [ 12312526 ]
Affects Version/s 0.20.1 [ 12314048 ]
Affects Version/s 0.21.0 [ 12313563 ]
Affects Version/s 0.20.1 [ 12313866 ]
Key HDFS-506 HADOOP-6272
Project Hadoop HDFS [ 12310942 ] Hadoop Common [ 12310240 ]
Urko Benito added a comment - 20/Sep/09 09:31 AM
I think there are some questions.
  1. The whoami without full path. As Allen says, the Solaris default installation comes with BSD Style Commands like whoami, id, etc. The questions is that Solaris is a SysV and if you put BSD style commands before SysV commands may be the system will be break. At the moment Solaris will be retro-compatible and will install the BSD Compatible Files by default, but if the user says not to install it will no be any BSD like commands on the Solaris box.
  1. The Solaris specific code, i think, yes it's a problem because we need to maintance but there's no option. For the whoami command we can use Java builtin function, but not for group
System.getProperty("user.name");

As a simple note, yes, you can hack the System.getProperty with a System.setProperty

  1. I subimited the diff to show how it can be solved, it was not a patch i'd create a patch but there was no agreement to create/commit the patch because it was Os specific, so i didn't do it.

I will create a HADOOP-6272 patch file with the changes, on tomorroy with JUnit test and so


Allen Wittenauer added a comment - 21/Sep/09 05:15 PM
Even tho I agree that maintaining OS specific code is ugly, I think it is unavoidable as long as we lack portable hooks into the OS. (No, reading the output of shell commands is not portable, this bug providing a relevant example.)

Using System.getProperty("user.name") is an interesting idea. As you say, that leaves us with group. So....

I'd like to suggest that we create a file in hadoop/bin with the sole purpose of providing portable ways to determine group information. Then all the OS-specific ugliness could be pushed into that and outside the Java code. Make it something like "hadoop-portable-groups" to lower the chances of hitting something real. You also eliminate any double fork()'s at the Java-level that would likely be the result of any OS-specific issues (consider the 'whoami' vs. the '/usr/ucb/whoami' Solaris case).


Amr Awadallah added a comment - 21/Sep/09 10:45 PM
> I'd like to suggest that we create a file in hadoop/bin with the sole
> purpose of providing portable ways to determine group information.

+1

– amr


Tsz Wo (Nicholas), SZE made changes - 21/Sep/09 10:55 PM
Link This issue relates to HADOOP-4998 [ HADOOP-4998 ]
Tsz Wo (Nicholas), SZE added a comment - 21/Sep/09 10:55 PM
{bq}
I'd like to suggest that we create a file in hadoop/bin with the sole purpose of providing portable ways to determine group information. Then all the OS-specific ugliness could be pushed into that and outside the Java code. Make it something like "hadoop-portable-groups" to lower the chances of hitting something real. You also eliminate any double fork()'s at the Java-level that would likely be the result of any OS-specific issues (consider the 'whoami' vs. the '/usr/ucb/whoami' Solaris case).{bq}

There is a jira, HADOOP-4998, on this direction.


Allen Wittenauer added a comment - 21/Sep/09 11:16 PM
No, HADOOP-4998 is about using JNI so that we can stop forking. Getting that implemented would fix this entire issue.

Owen O'Malley added a comment - 28/Sep/09 11:36 PM
If someone has free cycles, I agree that fixing HADOOP-4998 would be great.

In the mean time, I don't want to hard code paths for each particular operating system. If we take a patch for Solaris, it doesn't make sense to reject patches that add the path for the whoami command under BSD, etc.

In the short term, I'd suggest documenting the soft link fix in the hadoop/bin directory.

In the medium (0.22) term, we'll have Kerberos and Unix login via Jaas and groups done server side via HADOOP-4656.