You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2012/07/11 03:42:02 UTC

[Bug 53531] New: ExpandWar.expand does not check the return value of File.mkdirs

https://issues.apache.org/bugzilla/show_bug.cgi?id=53531

          Priority: P2
            Bug ID: 53531
          Assignee: dev@tomcat.apache.org
           Summary: ExpandWar.expand does not check the return value of
                    File.mkdirs
          Severity: trivial
    Classification: Unclassified
                OS: All
          Reporter: chris@christopherschultz.net
          Hardware: All
            Status: NEW
           Version: 5.5.35
         Component: Catalina
           Product: Tomcat 5

http://markmail.org/message/fvyxksx7muk3icr4

o.a.c.startup.ExpandWar.expand() calls File.mkdirs on line 165 and does not
check the return value. If the call fails, a subsequent attempt to create a new
FileOutputStream for a file in the (failed-to-create) directory results in a
FileNotFoundException with the whole filename as the message. Here is an
example from the above tomcat-user original post:

SEVERE: Exception fixing docBase: {0}
    java.io.FileNotFoundException:
/home/surgnet/public_html/sample/META-INF/MANIFEST.MF (No such file or
directory)
            at java.io.FileOutputStream.open(Native Method)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
            at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
            at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:457)
            at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:173)

This is confusing to users because the real issue has been hidden: the
inability to create the parent directory for the file.

The analogous code in the current trunk is:

                    if (!parent.mkdirs() && !parent.isDirectory()) {
                        throw new IOException(
                                sm.getString("expandWar.createFailed",
parent));
                    }

I believe this is the correct approach, which should be adopted for Tomcat 5.5.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

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

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29045|Patch against current trunk |Patch against current 5.5.x
        description|(r1359975)                  |trunk (r1359975)

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

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

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29045|0                           |1
        is obsolete|                            |

--- Comment #4 from Christopher Schultz <ch...@christopherschultz.net> ---
Comment on attachment 29045
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29045
Patch against current 5.5.x trunk (r1359975)

Patch is obsolete: patch proposed for 6.0.x.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

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

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Catalina                    |Catalina
            Version|5.5.35                      |6.0.35
            Product|Tomcat 5                    |Tomcat 6
   Target Milestone|---                         |default

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

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

--- Comment #2 from Christopher Schultz <ch...@christopherschultz.net> ---
This bug exists in Tomcat 6.0.x, so I'm re-assigning since it's a bit more
relevant. The fix can be thought of as a back-port, then, I guess.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

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

--- Comment #6 from Konstantin Kolinko <kn...@gmail.com> ---
Created attachment 29212
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29212&action=edit
2012-08-11_tc55_53531.patch

Patch for Tomcat 5.5.

Includes a fix for missing message argument in ContextConfig.init(). That is
where the thrown IOException is caught and logged.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

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

--- Comment #3 from Christopher Schultz <ch...@christopherschultz.net> ---
Created attachment 29050
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29050&action=edit
Patch for 6.0.x against r1359053

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 8/27/12 7:57 PM, Mark Thomas wrote:
> On 28/08/2012 00:53, Christopher Schultz wrote:
>> Mark,
> 
>> On 8/27/12 5:36 PM, bugzilla@apache.org wrote:
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=53531
>>>
>>> Mark Thomas <ma...@apache.org> changed:
>>>
>>> What    |Removed                     |Added 
>>> ----------------------------------------------------------------------------
>>>
>>>
> Component|Catalina                    |Catalina
>>> Version|6.0.35                      |Nightly Build Product|Tomcat
>>> 6                    |Tomcat 5 Target Milestone|default
>>> |---
> 
>> Uh, what?
> 
> It is fixed in 6.0.x but not 5.5.x so it got moved. When it gets fixed
> in 5.5.x it will get resolved.
> 
> Generally:
> - bugs are kept open against the highest supported version of Tomcat
> where they are still an issue
> - bugs are fixed in the every version from the one they are reported
> against up to trunk
> - bugs may be fixed in earlier versions than the one they were
> reported in if a committer feels the need to scratch that itch

Understood. Thanks for the clarification.

-chris


Re: [Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

Posted by Mark Thomas <ma...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28/08/2012 00:53, Christopher Schultz wrote:
> Mark,
> 
> On 8/27/12 5:36 PM, bugzilla@apache.org wrote:
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=53531
>> 
>> Mark Thomas <ma...@apache.org> changed:
>> 
>> What    |Removed                     |Added 
>> ----------------------------------------------------------------------------
>>
>> 
Component|Catalina                    |Catalina
>> Version|6.0.35                      |Nightly Build Product|Tomcat
>> 6                    |Tomcat 5 Target Milestone|default
>> |---
> 
> Uh, what?

It is fixed in 6.0.x but not 5.5.x so it got moved. When it gets fixed
in 5.5.x it will get resolved.

Generally:
- - bugs are kept open against the highest supported version of Tomcat
where they are still an issue
- - bugs are fixed in the every version from the one they are reported
against up to trunk
- - bugs may be fixed in earlier versions than the one they were
reported in if a committer feels the need to scratch that itch

Mark

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQPAlhAAoJEBDAHFovYFnnWVkQAKMQ8ePbQQbmtxCFSmUa5522
rV91THSawIu6erixF8gjjg2Fm8Kkhg9czFIJjtD26jA03JAyYX8ovVjXEx8IOGVi
mBnKP/tKj2rYEh+ngXUGKz0tYdKrSR2iFCVhOMQ/Pl7RWH7cyunNrsqjNZqouqSb
AqIQ9HO3+JMzti/kvc97rkQMqqAxOt/oY07FaU9dvnngTCTei4hbFnPDtfWaTt04
ouYECtxnxGT7z4XvRxReFF9HVdhH7C6A9Z0gwAAjyhxZbPCHH8v71FxFOPM4Ou4o
dI0fzq7G5pdpuSI0degm1mM6hpY6P7VPwJMdg+aAv1diPhitr4PAblbnWII7xHPo
B7KOkarggkiWk4aGdNdpZwHzdwL4xNrt0OFvfsdMYk71jyMenxaNGtiBejSTRGFM
XskToD376ElL2pgck4fRFuKj4QnLrix3ccg0fhfUbWBcSxYia1c8pNqNa59KXcV6
vr9jb9VtCfS6N8C8NK3gzWfGmOjRnvQYlkHe+eSQTlar3LpYySGK223ydKsfRM03
iUQneYk/70SG8jtz259KSXQAbdQKe2n2eC/W2jXsVw1tGpYO3ejlzGJgjSmggyFe
9pBBBAeBBmHgYD8d5vMl1HZi9QQ2CM3ed3BqFrdDpc+2yP2XeGrgKrBoAPmJVBPE
YyUcdF8QwI7vr0W/KnqS
=9FJz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Mark,

On 8/27/12 5:36 PM, bugzilla@apache.org wrote:
> https://issues.apache.org/bugzilla/show_bug.cgi?id=53531
> 
> Mark Thomas <ma...@apache.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Component|Catalina                    |Catalina
>             Version|6.0.35                      |Nightly Build
>             Product|Tomcat 6                    |Tomcat 5
>    Target Milestone|default                     |---

Uh, what?

-chris


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

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

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Catalina                    |Catalina
            Version|6.0.35                      |Nightly Build
            Product|Tomcat 6                    |Tomcat 5
   Target Milestone|default                     |---

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdirs

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

--- Comment #1 from Christopher Schultz <ch...@christopherschultz.net> ---
Created attachment 29045
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29045&action=edit
Patch against current trunk (r1359975)

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

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

--- Comment #5 from Christopher Schultz <ch...@christopherschultz.net> ---
Fixed in 6.0.x. Will be included in 6.0.36.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

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

Christopher Schultz <ch...@christopherschultz.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ExpandWar.expand does not   |ExpandWar.expand does not
                   |check the return value of   |check the return value of
                   |File.mkdirs                 |File.mkdir and File.mkdirs

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 53531] ExpandWar.expand does not check the return value of File.mkdir and File.mkdirs

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

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Mark Thomas <ma...@apache.org> ---
Fixed in 5.5.x and will be included in 5.5.36 onwards.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org