If you're going to use this, please add "Mac OS X". The cmd and flag can
be the same as Linux. 



-----Original Message-----
From: Niklas Gustavsson [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 22, 2008 8:39 AM
To: [email protected]
Subject: Re: File/Dir permissions

On Fri, Aug 22, 2008 at 2:23 PM, Andy Thomson <[EMAIL PROTECTED]>
wrote:
> I had proposed a change a while back to allow for new SITE commands. I

> have added quite a few using it: CHMOD, UTIME, DUAL [provides MD5 & 
> SHA1 hashes on a file or all files in a directory], and some custom 
> ones specific to my needs.
>
> Maybe it can posted/added as an "extra" for people that would want the

> ability to add custom SITE commands?  I would supply the ones above 
> and a generic template on how to do it.

Sure, or for those that doesn't cause any outrageous dependencies or
other problems, I'll be happy to include them in core. For those which
are not documented elsewhere, we should provide detailed documentation.

> One of the key tasks is to detect the OS platform the service is 
> running one and call the appropriate OS command shell & command. There

> was a good article about 7-8 years ago on this, not much has changed 
> from the JVM perspective [sad].

Yeah, I'm one of th commiters for the commons-exec project so I'm sadly
aware of this problem :-)

> Here is a snippet from the code:
>
>            String osName = System.getProperty("os.name");
>            String[] cmd = new String[3];
>
>            if (osName.equals("Windows 95")) {
>                cmd[0] = "command.com";
>                cmd[1] = "/C";
>                cmd[2] = cmdline;
>            } else if (osName.contains("Windows")) {
>                cmd[0] = "cmd.exe";
>                cmd[1] = "/C";
>                cmd[2] = cmdline;
>            } else if (osName.equals("Linux")) {
>                cmd[0] = "sh";
>                cmd[1] = "-c";
>                cmd[2] = cmdline;
>            }

Of course, keeping this up-to-date with all platforms is a pain.
Especially since developers usually have limited access to the more
obscure platforms. This is a problem with for example the VMS code in
commons-exec.

> The "cmdline" is a string that holds the actual command and it's
parameters:
> "/bin/chmod 755 somefile".  All error messages are passed back, works 
> same as command line.

Yeap, but is there such commands on for example Windows? In my
understanding, on Windows you need to use the Win32 API, for example
using JNI.

> Not sure what is the best way to get this code introduced? Maybe just 
> post it somewhere and reference it?

Attach it to a JIRA issue and make sure to tick the okay-for-inclusion
radio button and we can have a look at it.

/niklas



-----------------------------------------
Use of email is inherently insecure. Confidential information,
including account information, and personally identifiable
information, should not be transmitted via email, or email
attachment.  In no event shall Citizens or any of its affiliates
accept any responsibility for the loss, use or misuse of any
information including confidential information, which is sent to
Citizens or its affiliates via email, or email attachment. Citizens
does not guarantee the accuracy of any email or email attachment,
that an email will be received by Citizens or that Citizens will
respond to any email. 
 
This email message is confidential and/or privileged. It is to be
used by the intended recipient only.  Use of the information
contained in this email by anyone other than the intended recipient
is strictly prohibited. If you have received this message in error,
please notify the sender immediately and promptly destroy any
record of this email.

Reply via email to