Bug 863005 - ant overrides ANT_HOME
ant overrides ANT_HOME
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: ant (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaromír Cápík
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-04 04:07 EDT by Rasmus Kaj
Modified: 2016-01-31 20:57 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-10-04 06:22:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fixed ant.conf (459 bytes, application/octet-stream)
2012-10-04 04:07 EDT, Rasmus Kaj
no flags Details

  None (edit)
Description Rasmus Kaj 2012-10-04 04:07:44 EDT
Created attachment 621431 [details]
fixed ant.conf

Description of problem:

   Ant overrides ANT_HOME in /etc/ant.conf

Version-Release number of selected component (if applicable):

   ant-1.8.3-1.fc17

How reproducible:

   Always

Steps to Reproduce:
1. export ANT_HOME=/some/path/ant-other-version
2. ant
3. note that the system packaged 1.8.3 runs instead of (or interferes with) the old version
  
Actual results:

  Ant runs with ANT_HOME=/usr/share/ant

Expected results:

  Ant should run with the ANT_HOME exported from the shell.

Additional info:

  The attached replacing /etc/ant.conf with the attached file fixes the problem by checking if ANT_HOME is set before overriding it.  Also, if ANT_HOME has a user-provided value, rpm_mode should probably be false.
Comment 1 Alexander Kurtakov 2012-10-04 05:10:46 EDT
exporting ANT_HOME does not change your PATH so calling ant will still start /usr/bin/ant.
If you want to use another ant version do export PATH=/path/to/your/new/ant/bin:$PATH
Comment 2 Alexander Kurtakov 2012-10-04 05:19:25 EDT
Also you need to provide patches against http://pkgs.fedoraproject.org/cgit/ant.git/. 
Also if you look into /usr/bin/ant (which I think you're running) there is 
if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
      if [ -f "/etc/ant.conf" ] ; then
          . /etc/ant.conf
      fi
  fi

and this is what you have done in ant.conf but /etc/ant.conf is sourced only if ANT_HOME is not defined or points to /usr/share/ant so I don't see how does changing ant.conf to consider ANT_HOME help at all.
Comment 3 Rasmus Kaj 2012-10-04 06:22:40 EDT
Ah, sorry.  I should just make sure that /some/path/ant-other-version/bin/ant contains a similar conditional and ignores /etc/ant.conf if ANT_HOME is set then.

Yes, that is probably a better solution.

Thank you.  I'm closing this issue as NOTABUG.

Note You need to log in before you can comment on or make changes to this bug.