You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2016/04/26 19:14:49 UTC

[Bug 59379] New: Get task not quiet if dest file exists

https://bz.apache.org/bugzilla/show_bug.cgi?id=59379

            Bug ID: 59379
           Summary: Get task not quiet if dest file exists
           Product: Ant
           Version: 1.9.6
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: jlmuir@imca-cat.org

Created attachment 33806
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33806&action=edit
Test case

# Overview

The Get task is not quiet when the `dest' file exists and the `quiet' and
`skipexisting' attributes are set to `true'; it displays a message like this:

[get] Destination already exists (skipping): /tmp/ant-get-test/mylib.jar

# Steps to Reproduce

1. Save the attached build.xml file to the directory /tmp/ant-get-test (or
wherever)

2. Run Ant in the directory:

   $ ant

# Actual Results

Buildfile: /tmp/ant-get-test/build.xml

build:
    [touch] Creating /tmp/ant-get-test/mylib.jar
      [get] Destination already exists (skipping): /tmp/ant-get-test/mylib.jar

BUILD SUCCESSFUL
Total time: 0 seconds

# Expected Results

The Get task should not write the message about the destination file already
existing because the `quiet' attribute is set to `true':

Buildfile: /tmp/ant-get-test/build.xml

build:
    [touch] Creating /tmp/ant-get-test/mylib.jar

BUILD SUCCESSFUL
Total time: 0 seconds

# Build Date & Hardware

Ant 1.9.6 on OS X El Capitan (10.11.4).

# Additional Builds and Platforms

I haven't tested on other platforms, but the problem probably exists
everywhere.

# Additional Information

Looking at the source code for the Get task from the Git master branch, it
seems like one fix would be to only call the `log' method if the `quiet'
attribute is not set to `true' as in the attached get-quiet-skip-existing.diff
(untested).

Another approach would be to change the `log(String, int)' method to use a
different conditional for the `msgLevel' test.  Right now, it uses `msgLevel >=
Project.MSG_ERR', but in Project, MSG_ERR, MSG_WARN, MSG_INFO, MSG_VERBOSE, and
MSG_DEBUG are set to 0-4, respectively, so the `msgLevel >= Project.MSG_ERR'
test will always evaluate to true (and hence the super.log call will always be
made) unless a value less than 0 is specified (i.e. not one of the Project
class constants).

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59379] Get task not quiet if dest file exists

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59379

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |1.9.8
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Stefan Bodewig <bo...@apache.org> ---
Thank you!

I've opted to fix the logic inside the log method as the intend was to suppress
anything less severe than ERR - and it now does with commit 647bdfb - will be
fixed in 1.9.8 and 1.10.0.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59379] Get task not quiet if dest file exists

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59379

--- Comment #1 from J. Lewis Muir <jl...@imca-cat.org> ---
Created attachment 33807
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33807&action=edit
Fix

-- 
You are receiving this mail because:
You are the assignee for the bug.