hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Isaacson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-8386) hadoop script doesn't work if 'cd' prints to stdout (default behavior in Ubuntu)
Date Thu, 27 Sep 2012 02:49:07 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-8386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13464385#comment-13464385
] 

Andy Isaacson commented on HADOOP-8386:
---------------------------------------

If it's not an alias, cd hackery almost always is done using a shell function.  Also, a /bin/cd
command cannot work -- running it would fork a child process, change directory of the child
process, and then exit, having no impact on the parent shell process.

To figure out what your cd is doing, in bash use "type cd".
{noformat}
# first, define a function foo
$ foo() { echo bar; }
# now, run it
$ foo
bar
$ type foo
foo is a function
foo () 
{ 
    echo bar
}
$
{noformat}
In dash, {{type}} just says {{foo is a shell function}}.  I bet the original user is using
bash though.

bq. Fixes the 'hadoop' script to work on Ubuntu distro and others where the 'cd' command prints
to stdout

My ubuntu 12.04 install doesn't have any aliases or functions defined for cd, can you find
out what package is installing the evil settings in /etc/bash_completion.d (most likely) and
file an upstream bug?
{code}
ubuntu@ubu-cdh-0:~$ type cd
cd is a shell builtin
{code}
                
> hadoop script doesn't work if 'cd' prints to stdout (default behavior in Ubuntu)
> --------------------------------------------------------------------------------
>
>                 Key: HADOOP-8386
>                 URL: https://issues.apache.org/jira/browse/HADOOP-8386
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: scripts
>    Affects Versions: 1.0.2
>         Environment: Ubuntu
>            Reporter: Christopher Berner
>         Attachments: hadoop.diff
>
>
> if the 'hadoop' script is run as 'bin/hadoop' on a distro where the 'cd' command prints
to stdout, the script will fail due to this line: 'bin=`cd "$bin"; pwd`'
> Workaround: execute from the bin/ directory as './hadoop'
> Fix: change that line to 'bin=`cd "$bin" > /dev/null; pwd`'

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message