[
https://issues.apache.org/jira/browse/HADOOP-13079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15268221#comment-15268221
]
John Zhuge commented on HADOOP-13079:
-------------------------------------
Thanks [~cmccabe] and [~aw] for the comments. Some quotes from
[ls(1posix)|http://pubs.opengroup.org/onlinepubs/9699919799/]:
{quote}
Implementations may make -q the default for terminals to prevent trojan horse
attacks on terminals with special escape sequences. This is not required
because:
* Some control characters may be useful on some terminals; for example, a
system might write them as "\001" or "^A".
* Special behavior for terminals is not relevant to applications portability.
{quote}
However, it does not cover security concerns similar to
[CVE-2004-1488|http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-1488].
A quick survey shows {{ls}} defaults to {{-q}} on a terminal on Linux, BSD, and
OSX; but not on
[Solaris|https://docs.oracle.com/cd/E26502_01/html/E29030/ls-1.html].
> Add -q to fs -ls to print non-printable characters
> --------------------------------------------------
>
> Key: HADOOP-13079
> URL: https://issues.apache.org/jira/browse/HADOOP-13079
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: John Zhuge
> Assignee: John Zhuge
> Labels: supportability
>
> Add option {{-q}} to "hdfs dfs -ls" to print non-printable characters as "?".
> Non-printable characters are defined by
> [isprint(3)|http://linux.die.net/man/3/isprint] 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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]