You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Christopher Olsen (JIRA)" <ji...@apache.org> on 2007/01/11 22:21:27 UTC

[jira] Created: (IO-109) FileSystemUtils freeSpaceUnix does not work for HP-UX 11

FileSystemUtils freeSpaceUnix does not work for HP-UX 11
--------------------------------------------------------

                 Key: IO-109
                 URL: https://issues.apache.org/jira/browse/IO-109
             Project: Commons IO
          Issue Type: Bug
          Components: Utilities
    Affects Versions: 1.2
         Environment: uname -a
HP-UX mbfwdv B.11.11 U 9000/800 3509210950 unlimited-user license

            Reporter: Christopher Olsen


The freeSpaceUnix method does not work under HP-UX.  The df command under HP-UX is the old System V varient and the fields are not in the correct order.   This diff modifies the code to use the 'bdf' command when HP-UX is detected:

--- FileSystemUtils.java        2006-03-19 12:42:48.000000000 -0800
+++ FileSystemUtils-HP-UX-Fix.java      2007-01-11 13:05:34.844269000 -0800
@@ -51,13 +51,15 @@
     private static final int WINDOWS = 1;
     /** Operating system state flag for Unix. */
     private static final int UNIX = 2;
+    /** Unix variant name */
+       private static String osName = null;

     /** The operating system flag. */
     private static final int OS;
     static {
         int os = OTHER;
         try {
-            String osName = System.getProperty("os.name");
+            osName = System.getProperty("os.name");
             if (osName == null) {
                 throw new IOException("os.name not found");
             }
@@ -287,9 +289,18 @@
         }
         path = FilenameUtils.normalize(path);

+               // HP-UX sucks we need to use bdf instead
+               String dfCmd = "df";
+               String dfOpts = "-k";
+               if (osName.indexOf("hp-ux") != -1)
+               {
+                       dfCmd = "bdf";
+                       dfOpts = "";
+               }
+
         // build and run the 'dir' command
         String[] cmdAttribs =
-            (kb ? new String[] {"df", "-k", path} : new String[] {"df", path});
+            (kb ? new String[] {dfCmd, dfOpts, path} : new String[] {dfCmd, path});

         // read the output from the command until we come to the second line
         long bytes = -1;


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-109) FileSystemUtils freeSpaceUnix does not work for HP-UX 11

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IO-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467701 ] 

Stephen Colebourne commented on IO-109:
---------------------------------------

The new IO v1.3 release is going to use -kP. Let us know if this works.

> FileSystemUtils freeSpaceUnix does not work for HP-UX 11
> --------------------------------------------------------
>
>                 Key: IO-109
>                 URL: https://issues.apache.org/jira/browse/IO-109
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: uname -a
> HP-UX mbfwdv B.11.11 U 9000/800 3509210950 unlimited-user license
>            Reporter: Christopher Olsen
>         Attachments: FileSystemUtils-HP-UX.fix
>
>
> The freeSpaceUnix method does not work under HP-UX.  The df command under HP-UX is the old System V varient and the fields are not in the correct order.   This diff modifies the code to use the 'bdf' command when HP-UX is detected:
> --- FileSystemUtils.java        2006-03-19 12:42:48.000000000 -0800
> +++ FileSystemUtils-HP-UX-Fix.java      2007-01-11 13:05:34.844269000 -0800
> @@ -51,13 +51,15 @@
>      private static final int WINDOWS = 1;
>      /** Operating system state flag for Unix. */
>      private static final int UNIX = 2;
> +    /** Unix variant name */
> +       private static String osName = null;
>      /** The operating system flag. */
>      private static final int OS;
>      static {
>          int os = OTHER;
>          try {
> -            String osName = System.getProperty("os.name");
> +            osName = System.getProperty("os.name");
>              if (osName == null) {
>                  throw new IOException("os.name not found");
>              }
> @@ -287,9 +289,18 @@
>          }
>          path = FilenameUtils.normalize(path);
> +               // HP-UX sucks we need to use bdf instead
> +               String dfCmd = "df";
> +               String dfOpts = "-k";
> +               if (osName.indexOf("hp-ux") != -1)
> +               {
> +                       dfCmd = "bdf";
> +                       dfOpts = "";
> +               }
> +
>          // build and run the 'dir' command
>          String[] cmdAttribs =
> -            (kb ? new String[] {"df", "-k", path} : new String[] {"df", path});
> +            (kb ? new String[] {dfCmd, dfOpts, path} : new String[] {dfCmd, path});
>          // read the output from the command until we come to the second line
>          long bytes = -1;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-109) FileSystemUtils freeSpaceUnix does not work for HP-UX 11

Posted by "Christopher Olsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christopher Olsen updated IO-109:
---------------------------------

    Attachment: FileSystemUtils-HP-UX.fix

> FileSystemUtils freeSpaceUnix does not work for HP-UX 11
> --------------------------------------------------------
>
>                 Key: IO-109
>                 URL: https://issues.apache.org/jira/browse/IO-109
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: uname -a
> HP-UX mbfwdv B.11.11 U 9000/800 3509210950 unlimited-user license
>            Reporter: Christopher Olsen
>         Attachments: FileSystemUtils-HP-UX.fix
>
>
> The freeSpaceUnix method does not work under HP-UX.  The df command under HP-UX is the old System V varient and the fields are not in the correct order.   This diff modifies the code to use the 'bdf' command when HP-UX is detected:
> --- FileSystemUtils.java        2006-03-19 12:42:48.000000000 -0800
> +++ FileSystemUtils-HP-UX-Fix.java      2007-01-11 13:05:34.844269000 -0800
> @@ -51,13 +51,15 @@
>      private static final int WINDOWS = 1;
>      /** Operating system state flag for Unix. */
>      private static final int UNIX = 2;
> +    /** Unix variant name */
> +       private static String osName = null;
>      /** The operating system flag. */
>      private static final int OS;
>      static {
>          int os = OTHER;
>          try {
> -            String osName = System.getProperty("os.name");
> +            osName = System.getProperty("os.name");
>              if (osName == null) {
>                  throw new IOException("os.name not found");
>              }
> @@ -287,9 +289,18 @@
>          }
>          path = FilenameUtils.normalize(path);
> +               // HP-UX sucks we need to use bdf instead
> +               String dfCmd = "df";
> +               String dfOpts = "-k";
> +               if (osName.indexOf("hp-ux") != -1)
> +               {
> +                       dfCmd = "bdf";
> +                       dfOpts = "";
> +               }
> +
>          // build and run the 'dir' command
>          String[] cmdAttribs =
> -            (kb ? new String[] {"df", "-k", path} : new String[] {"df", path});
> +            (kb ? new String[] {dfCmd, dfOpts, path} : new String[] {dfCmd, path});
>          // read the output from the command until we come to the second line
>          long bytes = -1;

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-109) FileSystemUtils freeSpaceUnix does not work for HP-UX 11

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated IO-109:
-----------------------------

    Fix Version/s: 1.4

Marking these as 1.4 fix versions - not that we'll have any access to said platforms so it's more a question of cleaning these issues up if we don't hear back by the time of 1.4.

> FileSystemUtils freeSpaceUnix does not work for HP-UX 11
> --------------------------------------------------------
>
>                 Key: IO-109
>                 URL: https://issues.apache.org/jira/browse/IO-109
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: uname -a
> HP-UX mbfwdv B.11.11 U 9000/800 3509210950 unlimited-user license
>            Reporter: Christopher Olsen
>             Fix For: 1.4
>
>         Attachments: FileSystemUtils-HP-UX.fix
>
>
> The freeSpaceUnix method does not work under HP-UX.  The df command under HP-UX is the old System V varient and the fields are not in the correct order.   This diff modifies the code to use the 'bdf' command when HP-UX is detected:
> --- FileSystemUtils.java        2006-03-19 12:42:48.000000000 -0800
> +++ FileSystemUtils-HP-UX-Fix.java      2007-01-11 13:05:34.844269000 -0800
> @@ -51,13 +51,15 @@
>      private static final int WINDOWS = 1;
>      /** Operating system state flag for Unix. */
>      private static final int UNIX = 2;
> +    /** Unix variant name */
> +       private static String osName = null;
>      /** The operating system flag. */
>      private static final int OS;
>      static {
>          int os = OTHER;
>          try {
> -            String osName = System.getProperty("os.name");
> +            osName = System.getProperty("os.name");
>              if (osName == null) {
>                  throw new IOException("os.name not found");
>              }
> @@ -287,9 +289,18 @@
>          }
>          path = FilenameUtils.normalize(path);
> +               // HP-UX sucks we need to use bdf instead
> +               String dfCmd = "df";
> +               String dfOpts = "-k";
> +               if (osName.indexOf("hp-ux") != -1)
> +               {
> +                       dfCmd = "bdf";
> +                       dfOpts = "";
> +               }
> +
>          // build and run the 'dir' command
>          String[] cmdAttribs =
> -            (kb ? new String[] {"df", "-k", path} : new String[] {"df", path});
> +            (kb ? new String[] {dfCmd, dfOpts, path} : new String[] {dfCmd, path});
>          // read the output from the command until we come to the second line
>          long bytes = -1;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org