tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johanes Soetanto <otnat...@gmail.com>
Subject Re: Followup2: Changed behaviour of Tomcat Deployment/Context/Lifecycle Manager concerning symbolic links
Date Tue, 12 Mar 2019 20:03:05 GMT
Hi all,

On Tue, 12 Mar. 2019, 9:45 pm Jäkel, Guido, <G.Jaekel@dnb.de> wrote:

>-----Original Message-----
>From: Mark Thomas [mailto:markt@apache.org]
>Sent: Tuesday, March 12, 2019 12:51 AM
>To: users@tomcat.apache.org
>Subject: Re: Followup2: Changed behaviour of Tomcat
Deployment/Context/Lifecycle Manager concerning symbolic links

>Looking at the code in ContextConfig.fixDocBase() it looks like it
>should be possible to switch lines 585 and 587 to use getAbsolutePath()
>without having too much impact on any performance improvements we may
>want to consider. That should address the regression. @Guido can you
>confirm that please?


Using  getAbsolutePath()  instead of  getPath()  ...

                File file = new File(docBase);
                if (!file.isAbsolute()) {
        -            docBase = (new File(appBase,
docBase)).getCanonicalPath();
        +            docBase = (new File(appBase,
docBase)).getAbsolutePath();
                } else {
        -            docBase = file.getCanonicalPath();
        +            docBase = file.getAbsolutePath();
                }

also still solve the issue for me.


Here my minimal test set:

* At some auto-deploying location, create the empty WAR 'dst.war.'

        (You may use the following, if you like)

        # cat /opt/bin/mkemptyzip
        #!/bin/bash
        #
        # 20180516/gj

        if [ -z "$1" ]; then
          cat >&2 <<-EOT
                syntax : $0 <file>...
                purpose: generate empty zip file
                EOT
          exit -1
        fi
        for FILE; do
          [ -f "$FILE" ] && echo "file \"$FILE\" exists, skipping" &&
continue
          echo -en
'\x50\x4b\x05\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
>$FILE
        done

* Set up some different styled symlinks to it:

        root@testbcs0 /home/tomcatT-8/webapps/localhost # ll ???.*


        lrwxrwxrwx 1 root root 41 Mar 12 12:32 abs.war ->
/data/srv/test/webapps/localhost/dst.war.
        lrwxrwxrwx 1 root root  8 Mar 12 12:33 chn.war. -> dst.war.
        -rw-r--r-- 1 root root 22 Mar 12 12:32 dst.war.
        lrwxrwxrwx 1 root root  8 Mar 12 12:35 dsy.war -> chn.war.
        lrwxrwxrwx 1 root root  8 Mar 12 12:40 p#s.war -> chn.war.
        lrwxrwxrwx 1 root root  8 Mar 12 11:51 lnk.war -> dst.war.
        lrwxrwxrwx 1 root root 21 Mar 12 11:51 rel.war ->
../localhost/dst.war.


Correct me if I'm wrong. The original reason of this discussion if the file
extension does not end with war right? I don't see from test above that the
links do not ends with war. Or is it because of trailing dot at the end?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message