> On May 18, 2018, 4:57 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 87 (patched)
> > <https://reviews.apache.org/r/65811/diff/5/?file=2024592#file2024592line87>
> >
> >     I small nits, i'd suggest the following to make the logic a bit easier 
> > to understand:
> >     ```
> >     if (component != "..") {
> >       components.push_back(component);
> >     } else {
> >       if (isEmpty && !isAbs) {
> >         components.push_back(component);
> >       } else if (!isEmpty && components.back() == "..") {
> >         components.push_back(component);
> >       } else if (!isEmpty) {
> >         components.pop_back();
> >       }
> >     }
> >     ```
> 
> Jason Lai wrote:
>     I was originally using something similar to this. I think the current 
> version should be fine, as the comment should explain it. I also just 
> reference-checked [Python's implementation of 
> `os.path.normpath`](https://github.com/python/cpython/blob/2.7/Lib/posixpath.py#L346-L347),
>  it does things exactly the same way.
> 
> Jie Yu wrote:
>     The part that I found not intuitive to understand is the `else if` part. 
> That was my suggestion. I didn't put an issue on this so it's up to you.
> 
> Jie Yu wrote:
>     BTW, using comments to make the code readable is the worst way.

I changed to the style you suggested for the sake of readability after adding 
logic for bailing on escaping root.


- Jason


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review203392
-----------------------------------------------------------


On Sept. 21, 2018, 9:53 p.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated Sept. 21, 2018, 9:53 p.m.)
> 
> 
> Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, 
> James Peach, and Zhitao Li.
> 
> 
> Bugs: MESOS-8257
>     https://issues.apache.org/jira/browse/MESOS-8257
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Add `path::normalize` to stout for normalizing path (for POSIX only now).
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/path.hpp 
> ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/6/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>

Reply via email to