Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-13079

Add -q option to Ls to print ? instead of non-printable characters

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None

      Description

      Add option -q to "hdfs dfs -ls" to print non-printable characters as "?". Non-printable characters are defined by isprint(3) according to the current locale.

      Default to -q behavior on terminal; otherwise, print raw characters. See the difference in these 2 command lines:

      • hadoop fs -ls /dir
      • hadoop fs -ls /dir | od -c

      In C, isatty(STDOUT_FILENO) is used to find out whether the output is a terminal. Since Java doesn't have isatty, I will use JNI to call C isatty() because the closest test System.console() == null does not work in some cases.

        Attachments

        1. HADOOP-13079.004.patch
          18 kB
          John Zhuge
        2. HADOOP-13079.003.patch
          18 kB
          John Zhuge
        3. HADOOP-13079.002.patch
          17 kB
          John Zhuge
        4. HADOOP-13079.001.patch
          12 kB
          John Zhuge

          Issue Links

            Activity

              People

              • Assignee:
                jzhuge John Zhuge
                Reporter:
                jzhuge John Zhuge
              • Votes:
                0 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: