[
https://issues.apache.org/jira/browse/HADOOP-7393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13049509#comment-13049509
]
Daryn Sharp commented on HADOOP-7393:
-------------------------------------
As currently designed/implemented, I feel the premise of this jira is invalid,
however I do understand the sentiment. The PathData object is only intended
for internal use in FsShell. The cwd does not change during the execution of
any of the commands, so the relative path is not invalidated.
bq. Like Path, convert the pathstring to an absolute pathstring. [...]
bq. Don't store #string. [...]
This would unravel the benefit. The intent of storing the string is that what
you give it is +exactly+ what you get back, just like a unix shell, not a path
that has been mangled. If you were to take the old FsShell and feed it an
arbitrary path, you would have a hard time reliably matching the path in the
output.
bq. Store the absolute path (or Path) of the CWD at instantiation time. When
#string is referenced, compare the current WD to the stored WD, and if they
differ, convert #string to an absolute stringpath wrt the stored WD.
I would put forth the opinion that PathData is currently doing the "right
thing": relative paths are invalidated when pwd changes. At a normal shell,
if you were to type {{x=foo.txt}}, {{cat $x}}, {{cd somewhere-else}}, and again
{{cat $x}}, you certainly wouldn't expect the original {{foo.txt}} to be
displayed. If the desire is to use PathData outside of FsShell, I could
probably be swayed from this position.
My goal has been for FsShell to act and feel just like a real shell. That
said, I do welcome a response.
> PathData saves original string value, inviting failure when CWD changes
> -----------------------------------------------------------------------
>
> Key: HADOOP-7393
> URL: https://issues.apache.org/jira/browse/HADOOP-7393
> Project: Hadoop Common
> Issue Type: Bug
> Components: fs
> Affects Versions: 0.23.0
> Reporter: Matt Foley
>
> PathData#string stores the pathstring originally used to construct the Path,
> and returns it from various methods, apparently in an attempt to improve the
> user experience for the shell.
> However, the current working directory may change, and if so this string
> value becomes meaningless and/or incorrect in context.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira