You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Robert <ro...@yahoo.com> on 2013/03/03 03:14:05 UTC

pig shell script does not check for PIG_HOME being set prior to exporting

It looks like the pig shell script in v0.11 exports PIG_HOME without first checking to see if it already exists.

from line 78 in <path>/bin/pig:
# the root of the Pig installation
export PIG_HOME=`dirname "$this"`/..

Going through the script it appears most env variables are checked prior to setting, but not this one.  Is there a reason why?

Background: I ask this because I was getting an error resolving the path to pig.jar.  From what I gather it is because I use a symbolic link in /usr/local/bin to the pig script instead of modifying my PATH.  This meant `$this` in the bash script returned the path to /usr/local/bin instead of /usr/local/pig-0.11.0/bin.

I modified my local version to the following:

# the root of the Pig installation
if [ -z "$PIG_HOME" ]; then
    export PIG_HOME=`dirname "$this"`/..
fi

Is this something the script should have in it, or am I operating outside of the expected scenario?

Thanks,
Robert

Re: pig shell script does not check for PIG_HOME being set prior to exporting

Posted by Robert <ro...@yahoo.com>.
A JIRA issue has been created and the patch added as an attachment:

https://issues.apache.org/jira/browse/PIG-3244



________________________________
 From: Rohini Palaniswamy <ro...@gmail.com>
To: user@pig.apache.org; Robert <ro...@yahoo.com> 
Sent: Monday, March 4, 2013 5:44 AM
Subject: Re: pig shell script does not check for PIG_HOME being set prior to exporting
 
We should make PIG_HOME configurable. Can you create a jira and upload a
patch?

Thanks,
Rohini


On Sat, Mar 2, 2013 at 6:14 PM, Robert <ro...@yahoo.com> wrote:

> It looks like the pig shell script in v0.11 exports PIG_HOME without first
> checking to see if it already exists.
>
> from line 78 in <path>/bin/pig:
> # the root of the Pig installation
> export PIG_HOME=`dirname "$this"`/..
>
> Going through the script it appears most env variables are checked prior
> to setting, but not this one.  Is there a reason why?
>
> Background: I ask this because I was getting an error resolving the path
> to pig.jar.  From what I gather it is because I use a symbolic link in
> /usr/local/bin to the pig script instead of modifying my PATH.  This meant
> `$this` in the bash script returned the path to /usr/local/bin instead of
> /usr/local/pig-0.11.0/bin.
>
> I modified my local version to the following:
>
> # the root of the Pig installation
> if [ -z "$PIG_HOME" ]; then
>     export PIG_HOME=`dirname "$this"`/..
> fi
>
> Is this something the script should have in it, or am I operating outside
> of the expected scenario?
>
> Thanks,
> Robert

Re: pig shell script does not check for PIG_HOME being set prior to exporting

Posted by Rohini Palaniswamy <ro...@gmail.com>.
We should make PIG_HOME configurable. Can you create a jira and upload a
patch?

Thanks,
Rohini


On Sat, Mar 2, 2013 at 6:14 PM, Robert <ro...@yahoo.com> wrote:

> It looks like the pig shell script in v0.11 exports PIG_HOME without first
> checking to see if it already exists.
>
> from line 78 in <path>/bin/pig:
> # the root of the Pig installation
> export PIG_HOME=`dirname "$this"`/..
>
> Going through the script it appears most env variables are checked prior
> to setting, but not this one.  Is there a reason why?
>
> Background: I ask this because I was getting an error resolving the path
> to pig.jar.  From what I gather it is because I use a symbolic link in
> /usr/local/bin to the pig script instead of modifying my PATH.  This meant
> `$this` in the bash script returned the path to /usr/local/bin instead of
> /usr/local/pig-0.11.0/bin.
>
> I modified my local version to the following:
>
> # the root of the Pig installation
> if [ -z "$PIG_HOME" ]; then
>     export PIG_HOME=`dirname "$this"`/..
> fi
>
> Is this something the script should have in it, or am I operating outside
> of the expected scenario?
>
> Thanks,
> Robert