Bug 863005

Summary: ant overrides ANT_HOME
Product: [Fedora] Fedora Reporter: Rasmus Kaj <kaj>
Component: antAssignee: Jaromír Cápík <jcapik>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: akurtako, java-sig-commits, jcapik, kdaniel, mmatejov, ovasik, tradej
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-04 10:22:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
fixed ant.conf none

Description Rasmus Kaj 2012-10-04 08:07:44 UTC
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 09:10:46 UTC
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 09:19:25 UTC
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 10:22:40 UTC
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.