users@glassfish.java.net

Re: GF 3.1.1 - asadmin create-sytem-properties - how to escape 'backslash'

From: Bernhard Thalmayr <bernhard.thalmayr_at_painstakingminds.com>
Date: Tue, 20 Dec 2011 16:28:21 +0100

Thanks for your investigestions Paul , much appreciated.

I should have mentioned that I run 'asadmin' from a Linux box ... not from
a Windows box (secure admin, remote asadmin call)

If I do not escape the 'colon' the shell can not deal with the command at
all.

The 'set' command works in this constellation, however the
create-system-properties does not ... the backslash is never escaped
leading to a missing backslash in the value when viewing the config
through the web-console.

-Bernhard

On Tue, Dec 20, 2011 at 4:18 PM, Paul Davies <paul.m.davies_at_oracle.com>wrote:

> **
> Hi,
>
> At least some of the inconsistencies that you observe are the expected
> (and documented) behavior for these subcommands.
>
> According to the asadmin(1M)<http://docs.oracle.com/cd/E18930_01/html/821-2433/asadmin-1m.html#scrolltoc>man page, the colon must be escaped if it is part of a property or a Java
> Virtual Machine option. As the colon in the set command is not part of a
> property, I do not believe that the colon in the drive ID should be escaped.
>
> The asadmin(1M) man page also states that on Windows systems in single
> command mode, the backslash character does not require an escape character.
>
> My experiments with the set command are consistent with these
> observations. No escape characters seem to be required in a Windows path if
> the command is run in single mode on Windows:
>
> C:\>asadmin set
> configs.config.pmdconfig.java-config.native-library-path-prefix=C:\glassfish3\glassfish
>
> configs.config.pmdconfig.java-config.native-library-path-prefix=C:\glassfish3\glassfish
> Command set executed successfully.
>
> C:\>asadmin get
> configs.config.pmdconfig.java-config.native-library-path-prefix
>
>
> configs.config.pmdconfig.java-config.native-library-path-prefix=C:\glassfish3\glassfish
> Command get executed successfully.
>
> If I try to escape the colon and backslash characters, the escape
> characters are part of the attribute value that is set:
>
> C:\>asadmin set
> configs.config.pmdconfig.java-config.native-library-path-prefix=C\:\\glassfish3\\glassfish
>
> configs.config.pmdconfig.java-config.native-library-path-prefix=C\:\\glassfish3\\glassfish
> Command set executed successfully.
>
> C:\>asadmin get
> configs.config.pmdconfig.java-config.native-library-path-prefix
>
> configs.config.pmdconfig.java-config.native-library-path-prefix=C\:\\glassfish3\\glassfish
> Command get executed successfully.
>
> However, with create-system-property, it seems that the colon and
> backslash characters must be escaped, even on Windows systems in single
> mode:
>
> C:\>asadmin create-system-properties --target pmdconfig
> mydir=C\:\glassfish\glassfish3
> Command create-system-properties executed successfully.
>
> C:\>asadmin create-system-properties --target pmdconfig
> yourdir=C\:\\glassfish\\glassfish3
> Command create-system-properties executed successfully.
>
> C:\>asadmin list-system-properties pmdconfig
> The target pmdconfig contains following 2 system properties
> mydir=C:glassfishglassfish3
> yourdir=C:\glassfish\glassfish3
> Command list-system-properties executed successfully.
>
> This behavior contradicts the statement in the asadmin(1M) man page that
> on Windows systems in single command mode, the backslash character does not
> require an escape character. I'll follow up with the admin team to see if
> an issue is required against asadmin, create-system-properties or their
> man pages.
>
> Instead of escaping the colon and backslash characters individually, you
> can enclose the entire path in single quote (') characters:
>
> C:\>asadmin create-system-properties --target pmdconfig
> ourdir='C:\glassfish3\glassfish'
> Command create-system-properties executed successfully.
>
> C:\>asadmin list-system-properties pmdconfig
> The target pmdconfig contains following 3 system properties
> mydir=C:glassfishglassfish3
> yourdir=C:\glassfish\glassfish3
> ourdir=C:\glassfish3\glassfish
> Command list-system-properties executed successfully.
>
> Hope this helps.
>
> Regards,
> -Paul Davies
>
>
> On 12/20/2011 5:34 AM, Bernhard Thalmayr wrote:
>
> Hi experts,
>
> somehow it seems that the handling of backslashes is different for the
> different asadmin commands.
>
> Escaping a backslash using the 'create-system-properties does not seem to
> work, but escaping a backslash using the 'set' command works as expected
> (paths look correct using the console)
>
>
> set
> <config-name>.java-config.native-library-path-prefix=C\:\\<some-dir>\\<some-subdir>
>
> vs.
>
> create-system-properties --target <some-config>
> <SOME-VAR>=C\:\\<some-dir>\\<some-subdir>
>
> Any pointers avaialble?
>
> TIA,
> Bernhard
>
> --
> IT-Consulting Bernhard Thalmayr
> - Painstaking Minds -
> 83620 Vagen (Munich area)
> Germany
>
>


-- 
IT-Consulting Bernhard Thalmayr
- Painstaking Minds -
83620 Vagen (Munich area)
Germany