Help save net neutrality! Learn more.

#31 Up-to-date check of /tmp/winstone/... is incorrect


When given a war file in the command line, Winstone tries to check if the temporary exploded war directory is in sync with the war file, and skip the extraction when possible.

Unfortunately, this algorithm is broken for typical use cases, as discussed in

Say you have two war files of the same name "hudson.war" v1 and v2, and they are built on Jan and Feb respectively.

Now let's assume that it's March now, and the user installed v1. Now if he attempts to run v2, Winstone won't explode files because the extraction date of Mar is newer than Feb, but this is not what the user expected.

Similarly, if the user installed v2 first and then attempt to downgrade to v1, that fails too.

What's necessary is not to compare which is newer, but to create a timestamp file and make sure its timestamp is the same as the timestamp of the war. I attached a patch to do this.

It would be even more robust if we also check the size of the war file, but in practice timestamp is probably good enough.


  • Rick Knowles

    Rick Knowles - 2008-03-18

    Logged In: YES
    Originator: NO

    I can appreciate the problem here, but I'm not sure this is right solution - mainly because it ends up creating the .timestamp file inside the webroot (which incidentally your patch seems to rely on an outside source for: is this deliberate ? if so why ?)

    I'm still thinking about what would be a better solution, but I don't have anything yet. Ideally, the solution would

    a) not involve creating files inside the webroot (or any other webroot)
    b) be system managed (not requiring a file to be created)
    c) be practically invisible
    d) only take a few lines of code.

    The other alternatives I was considering were a --forceWarExtractionOverwrite or something like that (too slow) or maybe just do nothing (and rely on the packagers like yourself to create custom launchers that would handle this as desired, also not ideal).

    I'll think about it for a bit, the timestamp thing is a good suggestion, but I need to find some way to make it work more cleanly than this.

  • Kohsuke Kawaguchi

    Logged In: YES
    Originator: YES

    The timestamp file can be created outside war, such as by co-locating the file with the exploded war directory (e.g., /tmp/username/winstone/foo.timestamp for /tmp/username/winstone/foo)


Log in to post a comment.