tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: FarmWarDeployer not checking watchDir
Date Tue, 20 Jan 2015 22:57:58 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Théo,

On 1/20/15 5:42 PM, Christopher Schultz wrote:
> Théo,
> 
> On 1/20/15 12:42 PM, Théo Chamley wrote:
>> Thanks, found my problem by adding even more debugging than you. 
>> So, it came down to my watchDir being in 644 and not 755.
> 
> So, missing the execute bit?
> 
>> Because of this, the "war.exists()" in the modified() function
>> of the WarInfo class returned false. What was misleading is that
>> the watchDir.listFiles(new WarFilter()) function (line 71 of 
>> WarWatcher.java) was able to list the content of the directory…
> 
> I'll check out that behavior: WarWatcher can certainly use some 
> polishing as I've seen by looking at a bit of that code.

I have confirmed that Java can evidently list files in a directory
without execute permissions, but then the files don't "exist" as far
as File.exists is concerned:

$ java PermissionsTest 644 755 644/a_file 755/a_file
== File: 644
   exists: true
   canread: true
   canwrite: true
   canexecute: true
   children: [a_file]
== File: 755
   exists: true
   canread: true
   canwrite: true
   canexecute: true
   children: [a_file]
== File: 644/a_file
   exists: false
   canread: false
   canwrite: false
   canexecute: false
   children: null
== File: 755/a_file
   exists: true
   canread: true
   canwrite: true
   canexecute: true
   children: null

I'm actually really surprised that File.list() returns a list of files
for the directory that does not have execute permissions.

The problem with checking for "execute" permission is that it's a *NIX
implementation detail: on Windows, it would fail.

However, we *can* check to see that File.list() returns a list of
files that do exist. If the deployment directory is empty at startup,
there's no way to test this.

We could check in WarWatcher.check() to see if watchDir.listFiles
returns a list of non-existent files. There are some race-conditions
there but we could issue a WARN log message that something funny might
be going on.

Unfortunately, anything that's going to be perfect is going to be a
huge mess of platform-specific checks.

Can you log a Bugzilla enhancement for this? I'll add some checking to
WarWatcher as well as improved logging.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUvt12AAoJEBzwKT+lPKRY9Y8P/1J7Txcg7BBvSF8v0lgDVOs8
uu//+/vzQBbCV8qk0cTXtwHet5165rQjsRA7Vf5uFPrj9EL1KJ/vAoMiS7QmeFoS
gl2DGMtk1hXUNikxE0lRRuUlaKWoDOB7uowH2BHL5zKJEYZDASdXsXoNJ9pPGCTV
EnnjtBmMvC6Br41UCXSfCEdFySR9StMblWGZply9VsRIRDNoc1Wz7BatBN0840NK
Gukri2vlkNuiagno2I6NFBNZpU/uQ0a2r6xR0c5PS4ufzDy/n3VRljBNxHJy8I/r
4SmB7CwZXVE2cF2tg0+1xvta67qyyqvLe+CWURwTJvNu2DurVcVk3jO2JMFfXrHY
C3xZyhyeV8q3RZshrpRw62dkpNUIN/dHnsEG0GtHSYHTuXDbSbbm0b5XdRQP0wGy
umlHNkTwO2qfQT2dVCigNd7YNvMMwU9Z0S2k+vnx2+0NkuxMEHbzCuvD5Gv0XUHT
XG01+JMz9m6j6QGJjDa8lpjubDPDpAvnJgVe/FHABQeZcJkMrXgT5Ew60Oa0PrFJ
c/JgZTGR+8oeqDbmeMMRIBBQP7cQFaJHUIRWWAUwTMUaWeUT1afV91MR0oCNGZ50
oTTWrogipwewwWyUpZCTX7X3zJXs4z9yoEobm1XDB6in2jbq42Pru8QR+00s1FtZ
SRNEoGN/aGY4MyxEh9Ve
=nlfK
-----END PGP SIGNATURE-----

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


Mime
View raw message