> On Mar 4, 2019, at 9:33 AM, Daniel Templeton <dan...@cloudera.com> wrote:
> 
> Thanks!  That's not even close to what the docs suggest it does--no idea 
> what's up with that.

        It does. Here’s the paragraph:

"If the first character of parameter is an exclamation point (!), a level of 
variable indirection is introduced. Bash uses the value of the variable formed 
from the rest of parameter as the name of the variable; this variable is then 
expanded and that value is used in the rest of the substitution, rather than 
the value of parameter itself. This is known as indirect expansion. The 
exceptions to this are the expansions of ${!prefix*} and ${!name[@]} described 
below. The exclamation point must immediately follow the left brace in order to 
introduce indirection.”

        There’s a whole section on bash indirect references in the ABS as well. 
(Although I think most of the examples there still use \$$foo syntax with a 
note that it was replaced with ${!foo} syntax. lol.)

        For those playing at home, the hadoop shell code uses them almost 
entirely for utility functions in order to reduce the amount of code that would 
be needed to processes the ridiculous amount of duplicated env vars (e.g., 
HADOOP_HOME vs. HDFS_HOME vs YARN_HOME vs …).

> This issue only shows up if the user uses the hadoop command to run an 
> arbitrary class not in the default package, e.g. "hadoop 
> org.apache.hadoop.conf.Configuration".  We've been quietly allowing that 
> misuse forever.  Unfortunately, treating CLI output as an API means we can't 
> change that behavior in a minor.  We could, however, deprecate it and add a 
> warning when it's used.  I think that would cover us sufficiently if someone 
> trips on the Ubuntu 18 regression.
> 
> Thoughts?

        Oh, I think I see the bug.  HADOOP_SUBCMD (and equivalents in yarn, 
hdfs, etc) just needs some special handling when a custom method is being 
called.  For example, there’s no point in checking to see if it should run with 
privileges, so just skip over that.  Probably a few other places too.  
Relatively easy fix.  2 lines of code, maybe.


---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to