ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: Apply argument wrapping with msiexec
Date Wed, 10 Nov 2010 21:51:50 GMT

coming late into the game..
 
I ALWAYS use C:/DOCUME~1 instead of C:/Documents and Settings 
and the shortened folder names always work with every tool under sun

i have to inquire why bring msiexec into the mix?
you can make, package and copy all with ant tools (and now with maven using maven-nar-plugin)
why drag msiexec into the build which works only some of the time and ONLY with microsofts
version of microsoft installer the msiexec originally came with
?

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.



 

> Date: Wed, 10 Nov 2010 22:10:57 +0100
> From: ml_ant-user@nmhq.net
> To: user@ant.apache.org
> Subject: Re: Apply argument wrapping with msiexec
> 
> This is interesting. It's caused by Java's Runtime.exec(), which
> doesn't handle embedded double quotes in command line arguments
> appropriately for this use case.
> 
> To pass the command line to Win32's CreateProcess function, which
> takes the command line as a single string, Java needs to concatenate
> the executable path and the arguments to produce that string. This is
> done in ProcessImpl.start(), see below [1] for the relevant source
> code
> 
> As can be seen from the source code, if a command line element
> contains a space or tab character, the element is enclosed in double
> quotes unless already fully enclosed, and disregarding potential
> embedded quotes in the argument. This means that the argument
> 
> TARGETDIR="C:\Documents and Settings\Test"
> 
> is transformed to
> 
> "TARGETDIR="C:\Documents and Settings\Test""
> 
> which msiexec then of course fails to parse.
> 
> I'm aware of two conventions (depends on the individual application)
> for embedding quotes within quoted arguments under Windows: by
> escaping with backslash, or by doubling the embedded quotes:
> 
> "TARGETDIR=\"C:\Documents and Settings\Test\""
> "TARGETDIR=""C:\Documents and Settings\Test"""
> 
> Msiexec doesn't seem to support either, at least not for property
> settings, so quoting the complete argument cannot be used as a
> workaround.
> 
> I think it would be appropriate to file a bug report for
> Runtime.exec(). If its implementation would only add quotes if the
> string didn't already contain quotes around the whitespace, there
> wouldn't be a problem.
> 
> As a workaround, I would suggest writing the command to a temporary
> batch file and execute that.
> 
> -- Niklas Matthies
> 
> [1] From ProcessImpl.java version 1.32, 06/03/22,
> from my version of JDK 1.6:
> 
> StringBuilder cmdbuf = new StringBuilder(80);
> for (int i = 0; i < cmd.length; i++) {
> if (i > 0) {
> cmdbuf.append(' ');
> }
> String s = cmd[i];
> if (s.indexOf(' ') >= 0 || s.indexOf('\t') >= 0) {
> if (s.charAt(0) != '"') {
> cmdbuf.append('"');
> cmdbuf.append(s);
> if (s.endsWith("\\")) {
> cmdbuf.append("\\");
> }
> cmdbuf.append('"');
> } else if (s.endsWith("\"")) {
> /* The argument has already been quoted. */
> cmdbuf.append(s);
> } else {
> /* Unmatched quote for the argument. */
> throw new IllegalArgumentException();
> }
> } else {
> cmdbuf.append(s);
> }
> }
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
 		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message