You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Chris Nauroth (JIRA)" <ji...@apache.org> on 2014/01/21 20:37:23 UTC

[jira] [Commented] (HADOOP-10247) FsShell -ls -R output misaligned if child path has longer string representation than parent.

    [ https://issues.apache.org/jira/browse/HADOOP-10247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13877777#comment-13877777 ] 

Chris Nauroth commented on HADOOP-10247:
----------------------------------------

See below for sample output that demonstrates the problem.  The reason for this is that {{Ls#adjustColumnWidths}} executes separately for each recursion down the tree via the base {{Command}} class.  Therefore, it can calculate the max lengths and readjust only for the subset of paths that it encounters within that recursion.  If it encounters a larger max length lower down in the tree, then it's too late to adjust for the paths higher in the tree that were already printed.

I don't see an obvious way to fix this completely.  I don't think we can iterate through all paths recursively to get a more accurate max length calculation, because that would require holding the whole tree in memory on the client side.

{code}
[chris@Chriss-MacBook-Pro:ttys003] hadoop-deploy-HDFS-4685                                                          
> hadoop-3.0.0-SNAPSHOT/bin/hdfs dfs -ls -R /
drwxr-xr-x   - chris supergroup          0 2014-01-18 08:50 /dir1
-rw-r--r--   3 chris        supergroup          6 2014-01-18 08:50 /dir1/file1
-rw-r--r--   3 longusername supergroup          6 2014-01-18 08:50 /dir1/file2
drwxr-xr-x   - chris        supergroup          0 2014-01-18 08:50 /dir2
-rwxrwxrwt   3 chris        supergroup          6 2014-01-19 10:56 /file3
{code}


> FsShell -ls -R output misaligned if child path has longer string representation than parent.
> --------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-10247
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10247
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: fs
>    Affects Versions: 2.2.0
>            Reporter: Chris Nauroth
>            Priority: Minor
>
> When running a recursive ls, like {{hdfs dfs -ls -R /}}, the column formatting becomes misaligned if there is a child path with a longer string representation (such as caused by a longer username) compared to its parent.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)