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

          Eugene Koontz created issue -
          Eugene Koontz made changes -
          Field Original Value New Value
          Summary empty-string owners or groups causes {{MissingFormatWidthExeption}} in o.a.h.fs.shell.Ls.ProcessPath() empty-string owners or groups causes {{MissingFormatWidthException}} in o.a.h.fs.shell.Ls.ProcessPath()
          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.
          Eugene Koontz made changes -
          Attachment HADOOP-8168.patch [ 12518214 ]
          Eugene Koontz made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          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
          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
          Eugene Koontz made changes -
          Link This issue relates to HADOOP-4335 [ HADOOP-4335 ]
          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.
          Eugene Koontz made changes -
          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.5.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.5.0/docs/api/java/util/MissingFormatWidthException.html
          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
          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
          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
          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
          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
          Alejandro Abdelnur made changes -
          Link This issue is duplicated by HADOOP-8496 [ HADOOP-8496 ]
          Hide
          Alejandro Abdelnur added a comment -

          +1, built & tested with S3

          Show
          Alejandro Abdelnur added a comment - +1, built & tested with S3
          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 -

          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.
          Alejandro Abdelnur made changes -
          Attachment HADOOP-8496.patch [ 12533850 ]
          Hide
          Daryn Sharp added a comment -

          +1 looks good to me

          Show
          Daryn Sharp added a comment - +1 looks good to me
          Alejandro Abdelnur made changes -
          Assignee Eugene Koontz [ ekoontz ]
          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.
          Alejandro Abdelnur made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Hadoop Flags Reviewed [ 10343 ]
          Fix Version/s 2.0.1-alpha [ 12321441 ]
          Resolution Fixed [ 1 ]
          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
          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-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 #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 #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
          Arun C Murthy made changes -
          Fix Version/s 2.0.2-alpha [ 12322473 ]
          Fix Version/s 2.1.0-alpha [ 12321441 ]
          Arun C Murthy made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Patch Available Patch Available
          7m 29s 1 Eugene Koontz 13/Mar/12 18:46
          Patch Available Patch Available Resolved Resolved
          106d 22h 57m 1 Alejandro Abdelnur 28/Jun/12 18:44
          Resolved Resolved Closed Closed
          105d 1m 1 Arun C Murthy 11/Oct/12 18:45

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development