Hadoop Common
  1. Hadoop Common
  2. HADOOP-8168

empty-string owners or groups causes {{MissingFormatWidthException}} in o.a.h.fs.shell.Ls.ProcessPath()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.23.1, 0.24.0
    • Fix Version/s: 2.0.2-alpha
    • Component/s: fs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      In adjustColumnWidths(), we set the member variable lineFormat, which is used by ProcessPath() to print directory entries. Owners and groups are formatted using the formatting conversion %-Xs, where X is the max length of the owner or group. However, when trying this with an S3 URL, I found that the owner and group were empty (""). This caused X to be 0, which means that the formatting conversion is set to %-0s. This caused a MissingFormatWidthException to be thrown when the formatting string was used in ProcessPath().

      Formatting conversions are described here:

      http://docs.oracle.com/javase/1.6.0/docs/api/java/util/Formatter.html#intFlags

      The specific exception thrown (a subtype of IllegalFormatException) is described here:

      http://docs.oracle.com/javase/1.6.0/docs/api/java/util/MissingFormatWidthException.html

      1. HADOOP-8496.patch
        1 kB
        Alejandro Abdelnur
      2. HADOOP-8168.patch
        1 kB
        Eugene Koontz

        Issue Links

          Activity

          Hide
          Hudson added a comment -

          Integrated in Hadoop-Mapreduce-trunk #1124 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1124/)
          HADOOP-8168. empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085)

          Result = FAILURE
          tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085
          Files :

          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Show
          Hudson added a comment - Integrated in Hadoop-Mapreduce-trunk #1124 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/1124/ ) HADOOP-8168 . empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085) Result = FAILURE tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085 Files : /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk #1091 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/1091/)
          HADOOP-8168. empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085)

          Result = FAILURE
          tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085
          Files :

          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk #1091 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/1091/ ) HADOOP-8168 . empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085) Result = FAILURE tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085 Files : /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Mapreduce-trunk-Commit #2421 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Commit/2421/)
          HADOOP-8168. empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085)

          Result = FAILURE
          tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085
          Files :

          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Show
          Hudson added a comment - Integrated in Hadoop-Mapreduce-trunk-Commit #2421 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Commit/2421/ ) HADOOP-8168 . empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085) Result = FAILURE tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085 Files : /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Hdfs-trunk-Commit #2471 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Commit/2471/)
          HADOOP-8168. empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085)

          Result = SUCCESS
          tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085
          Files :

          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Show
          Hudson added a comment - Integrated in Hadoop-Hdfs-trunk-Commit #2471 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Commit/2471/ ) HADOOP-8168 . empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085) Result = SUCCESS tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085 Files : /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Common-trunk-Commit #2402 (See https://builds.apache.org/job/Hadoop-Common-trunk-Commit/2402/)
          HADOOP-8168. empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085)

          Result = SUCCESS
          tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085
          Files :

          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
          • /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Show
          Hudson added a comment - Integrated in Hadoop-Common-trunk-Commit #2402 (See https://builds.apache.org/job/Hadoop-Common-trunk-Commit/2402/ ) HADOOP-8168 . empty-string owners or groups causes MissingFormatWidthException in o.a.h.fs.shell.Ls.ProcessPath() (ekoontz via tucu) (Revision 1355085) Result = SUCCESS tucu : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1355085 Files : /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt /hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Ls.java
          Hide
          Alejandro Abdelnur added a comment -

          Thanks Eugene. Committed to trunk and branch-2.

          Show
          Alejandro Abdelnur added a comment - Thanks Eugene. Committed to trunk and branch-2.
          Hide
          Daryn Sharp added a comment -

          +1 looks good to me

          Show
          Daryn Sharp added a comment - +1 looks good to me
          Hide
          Alejandro Abdelnur added a comment -

          Eugene, I'm uploading a patch tweaking your patch to Daryn's comments. Hope this is OK with you.

          I've tested with local/hdfs/s3 filesystem.

          Show
          Alejandro Abdelnur added a comment - Eugene, I'm uploading a patch tweaking your patch to Daryn's comments. Hope this is OK with you. I've tested with local/hdfs/s3 filesystem.
          Hide
          Alejandro Abdelnur added a comment -

          Eugene, just noticed you did not update the patch to Daryn's suggestion. Would you mind uploading a new patch?

          Show
          Alejandro Abdelnur added a comment - Eugene, just noticed you did not update the patch to Daryn's suggestion. Would you mind uploading a new patch?
          Hide
          Alejandro Abdelnur added a comment -

          +1, built & tested with S3

          Show
          Alejandro Abdelnur added a comment - +1, built & tested with S3
          Hide
          Eugene Koontz added a comment -

          Hi Daryn, Your fix looks a bit cleaner than mine, thanks!
          -Eugene

          Show
          Eugene Koontz added a comment - Hi Daryn, Your fix looks a bit cleaner than mine, thanks! -Eugene
          Hide
          Daryn Sharp added a comment -

          Ignore the Math.min. I'm tired.

          Show
          Daryn Sharp added a comment - Ignore the Math.min . I'm tired.
          Hide
          Daryn Sharp added a comment -

          I think you meant Math.min. Although I'd suggest maybe something like this to avoid spurious whitespace:

          fmt.append((maxOwner > 0) ? "%-" + maxOwner + "s " : "%s");
          
          Show
          Daryn Sharp added a comment - I think you meant Math.min . Although I'd suggest maybe something like this to avoid spurious whitespace: fmt.append((maxOwner > 0) ? "%-" + maxOwner + "s " : "%s" );
          Hide
          Hadoop QA added a comment -

          -1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12518214/HADOOP-8168.patch
          against trunk revision .

          +1 @author. The patch does not contain any @author tags.

          -1 tests included. The patch doesn't appear to include any new or modified tests.
          Please justify why no new tests are needed for this patch.
          Also please list what manual steps were performed to verify this patch.

          +1 javadoc. The javadoc tool did not generate any warning messages.

          +1 javac. The applied patch does not increase the total number of javac compiler warnings.

          +1 eclipse:eclipse. The patch built with eclipse:eclipse.

          +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings.

          +1 release audit. The applied patch does not increase the total number of release audit warnings.

          -1 core tests. The patch failed these unit tests:
          org.apache.hadoop.fs.viewfs.TestViewFsTrash
          org.apache.hadoop.ipc.TestRPCCallBenchmark

          +1 contrib tests. The patch passed contrib unit tests.

          Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/707//testReport/
          Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/707//console

          This message is automatically generated.

          Show
          Hadoop QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12518214/HADOOP-8168.patch against trunk revision . +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 eclipse:eclipse. The patch built with eclipse:eclipse. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. -1 core tests. The patch failed these unit tests: org.apache.hadoop.fs.viewfs.TestViewFsTrash org.apache.hadoop.ipc.TestRPCCallBenchmark +1 contrib tests. The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/707//testReport/ Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/707//console This message is automatically generated.
          Hide
          Eugene Koontz added a comment -

          HADOOP-4335 seems to be the same bug.

          Show
          Eugene Koontz added a comment - HADOOP-4335 seems to be the same bug.
          Show
          Eugene Koontz added a comment - Sorry, correct line number is : https://github.com/apache/hadoop-common/blob/branch-1.0/src/core/org/apache/hadoop/fs/FsShell.java#L628
          Hide
          Eugene Koontz added a comment -

          Note that a similar 0-length check for groups and owners is present in Hadoop 1.0:

          https://github.com/apache/hadoop-common/blob/branch-1.0/src/core/org/apache/hadoop/fs/FsShell.java#L645

          Show
          Eugene Koontz added a comment - Note that a similar 0-length check for groups and owners is present in Hadoop 1.0: https://github.com/apache/hadoop-common/blob/branch-1.0/src/core/org/apache/hadoop/fs/FsShell.java#L645
          Hide
          Eugene Koontz added a comment -

          Make sure that for %-Xs formatting conversions, X is greater than 0.

          Show
          Eugene Koontz added a comment - Make sure that for %-Xs formatting conversions, X is greater than 0.

            People

            • Assignee:
              Eugene Koontz
              Reporter:
              Eugene Koontz
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development