You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Jason Lai <ja...@jasonlai.net> on 2018/05/08 18:41:38 UTC

Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

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

(Updated May 8, 2018, 6:41 p.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Renamed `path::clean` to `path::normalize` per review comment.


Summary (updated)
-----------------

Add `path::normalize` to stout for normalizing path (for POSIX only now)


Bugs: MESOS-8257
    https://issues.apache.org/jira/browse/MESOS-8257


Repository: mesos


Description (updated)
-------

Add `path::normalize` to stout for normalizing path (for POSIX only now).


Diffs (updated)
-----

  3rdparty/stout/include/stout/path.hpp 27438d31617b3b78bf3d4deffd25c93340610e8d 


Diff: https://reviews.apache.org/r/65811/diff/4/

Changes: https://reviews.apache.org/r/65811/diff/3-4/


Testing
-------


Thanks,

Jason Lai


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.

> On Sept. 24, 2018, 7:53 p.m., Eric Chung wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 63 (patched)
> > <https://reviews.apache.org/r/65811/diff/6/?file=2091015#file2091015line63>
> >
> >     perhaps rephrase as: `...without touching the actual filesystem.`

Fixed.


> On Sept. 24, 2018, 7:53 p.m., Eric Chung wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 77 (patched)
> > <https://reviews.apache.org/r/65811/diff/6/?file=2091015#file2091015line77>
> >
> >     `in Windows as well as absolute paths` sounds a little weird. are these two separate todo items or one?

Fixed.


- Jason


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


On Sept. 24, 2018, 8:38 p.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated Sept. 24, 2018, 8:38 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/7/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Eric Chung <ci...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review208903
-----------------------------------------------------------




3rdparty/stout/include/stout/path.hpp
Lines 63 (patched)
<https://reviews.apache.org/r/65811/#comment293178>

    perhaps rephrase as: `...without touching the actual filesystem.`



3rdparty/stout/include/stout/path.hpp
Lines 77 (patched)
<https://reviews.apache.org/r/65811/#comment293188>

    `in Windows as well as absolute paths` sounds a little weird. are these two separate todo items or one?


- Eric Chung


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
> 
>


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Eric Chung <ci...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review208963
-----------------------------------------------------------


Ship it!




Ship It!

- Eric Chung


On Sept. 24, 2018, 8:40 p.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated Sept. 24, 2018, 8:40 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
> -------
> 
> Added `path::normalize` to normalize a given pathname and remove
> redundant separators and up-level references.
> 
> This function follows the rules described in `path_resolution(7)`
> for Linux. However, it only performs pure lexical processing without
> touching the actual filesystem.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/7/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review210638
-----------------------------------------------------------


Ship it!




Ship It!

- Jie Yu


On Nov. 7, 2018, 10:10 p.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated Nov. 7, 2018, 10:10 p.m.)
> 
> 
> Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.
> 
> 
> Bugs: MESOS-8257 and MESOS-9009
>     https://issues.apache.org/jira/browse/MESOS-8257
>     https://issues.apache.org/jira/browse/MESOS-9009
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added `path::normalize` to normalize a given pathname and remove
> redundant separators and up-level references.
> 
> This function follows the rules described in `path_resolution(7)`
> for Linux. However, it only performs pure lexical processing without
> touching the actual filesystem.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/9/
> 
> 
> Testing
> -------
> 
> `make tests and make check` with https://reviews.apache.org/r/68832/
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated Nov. 7, 2018, 10:10 p.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Required for [MESOS-9009](https://issues.apache.org/jira/browse/MESOS-9009)


Bugs: MESOS-8257 and MESOS-9009
    https://issues.apache.org/jira/browse/MESOS-8257
    https://issues.apache.org/jira/browse/MESOS-9009


Repository: mesos


Description
-------

Added `path::normalize` to normalize a given pathname and remove
redundant separators and up-level references.

This function follows the rules described in `path_resolution(7)`
for Linux. However, it only performs pure lexical processing without
touching the actual filesystem.


Diffs
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/9/


Testing
-------

`make tests and make check` with https://reviews.apache.org/r/68832/


Thanks,

Jason Lai


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated Nov. 7, 2018, 9:22 p.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Rebased to master


Bugs: MESOS-8257
    https://issues.apache.org/jira/browse/MESOS-8257


Repository: mesos


Description
-------

Added `path::normalize` to normalize a given pathname and remove
redundant separators and up-level references.

This function follows the rules described in `path_resolution(7)`
for Linux. However, it only performs pure lexical processing without
touching the actual filesystem.


Diffs (updated)
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/9/

Changes: https://reviews.apache.org/r/65811/diff/8-9/


Testing
-------

`make tests and make check` with https://reviews.apache.org/r/68832/


Thanks,

Jason Lai


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated Sept. 26, 2018, 11:59 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
-------

Added `path::normalize` to normalize a given pathname and remove
redundant separators and up-level references.

This function follows the rules described in `path_resolution(7)`
for Linux. However, it only performs pure lexical processing without
touching the actual filesystem.


Diffs
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/8/


Testing (updated)
-------

`make tests and make check` with https://reviews.apache.org/r/68832/


Thanks,

Jason Lai


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Eric Chung <ci...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review208977
-----------------------------------------------------------


Ship it!




Ship It!

- Eric Chung


On Sept. 25, 2018, 12:08 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated Sept. 25, 2018, 12:08 a.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
> -------
> 
> Added `path::normalize` to normalize a given pathname and remove
> redundant separators and up-level references.
> 
> This function follows the rules described in `path_resolution(7)`
> for Linux. However, it only performs pure lexical processing without
> touching the actual filesystem.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/8/
> 
> 
> Testing
> -------
> 
> `make tests` with https://reviews.apache.org/r/68832/
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated Sept. 25, 2018, 12:08 a.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Updated comment for failure on attempting to escape root and minor change.


Bugs: MESOS-8257
    https://issues.apache.org/jira/browse/MESOS-8257


Repository: mesos


Description
-------

Added `path::normalize` to normalize a given pathname and remove
redundant separators and up-level references.

This function follows the rules described in `path_resolution(7)`
for Linux. However, it only performs pure lexical processing without
touching the actual filesystem.


Diffs (updated)
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/8/

Changes: https://reviews.apache.org/r/65811/diff/7-8/


Testing (updated)
-------

`make tests` with https://reviews.apache.org/r/68832/


Thanks,

Jason Lai


Re: Review Request 65811: Added Stout `path::normalize` function for POSIX paths.

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated Sept. 24, 2018, 8:40 p.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Updated summary and description.


Summary (updated)
-----------------

Added Stout `path::normalize` function for POSIX paths.


Bugs: MESOS-8257
    https://issues.apache.org/jira/browse/MESOS-8257


Repository: mesos


Description (updated)
-------

Added `path::normalize` to normalize a given pathname and remove
redundant separators and up-level references.

This function follows the rules described in `path_resolution(7)`
for Linux. However, it only performs pure lexical processing without
touching the actual filesystem.


Diffs
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/7/


Testing
-------


Thanks,

Jason Lai


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated Sept. 24, 2018, 8:38 p.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Address review comments from @cinchurge.


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 (updated)
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/7/

Changes: https://reviews.apache.org/r/65811/diff/6-7/


Testing
-------


Thanks,

Jason Lai


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
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.


Changes
-------

Address @jieyu's review comments.


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 (updated)
-----

  3rdparty/stout/include/stout/path.hpp ef5a2f3d14cc8cf7416ded5cad00d30a49fd5cf7 


Diff: https://reviews.apache.org/r/65811/diff/6/

Changes: https://reviews.apache.org/r/65811/diff/5-6/


Testing
-------


Thanks,

Jason Lai


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by James Peach <jp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review203605
-----------------------------------------------------------



Please update the commit message to < 72 characters:

```
$ ./support/apply-reviews.py -c -r 67177
2018-05-22 15:13:11 URL:https://reviews.apache.org/r/65811/diff/raw/ [2315/2315] -> "65811.patch" [1]
Checking 1 C++ file
Done processing 3rdparty/stout/include/stout/path.hpp
Total errors found: 0
Total errors found: 0
No JavaScript files to lint
No Python files to lint
Error: No line in the commit message summary may exceed 72 characters.
```

I suggest that the commit message should be:
```
Added Stout `path::normalize` API for POSIX paths.

Added `path::normalize` to normalize a given pathname and remove
redundant separators and up-level references.  This function
follows the rules described in path_resolution(7) for Linux,
however, it only performs pure lexical processing without
touching the actual filesystem.
```

- James Peach


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.

> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 60 (patched)
> > <https://reviews.apache.org/r/65811/diff/5/?file=2024592#file2024592line60>
> >
> >     In fact, I'd return `Try` if it escapes the root path, this will allow us to avoid some silent errors in the subsequent patch (silently change the intended path, instead of a failure).

Done.


- Jason


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


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
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review203453
-----------------------------------------------------------




3rdparty/stout/include/stout/path.hpp
Lines 60 (patched)
<https://reviews.apache.org/r/65811/#comment285686>

    In fact, I'd return `Try` if it escapes the root path, this will allow us to avoid some silent errors in the subsequent patch (silently change the intended path, instead of a failure).


- Jie Yu


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jie Yu <yu...@gmail.com>.

> 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.

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


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


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.

> 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();
> >       }
> >     }
> >     ```

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.


- Jason


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


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.

> 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
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jie Yu <yu...@gmail.com>.

> 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.

BTW, using comments to make the code readable is the worst way.


- Jie


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


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review203392
-----------------------------------------------------------


Ship it!





3rdparty/stout/include/stout/path.hpp
Lines 87 (patched)
<https://reviews.apache.org/r/65811/#comment285639>

    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();
      }
    }
    ```


- Jie Yu


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/
-----------------------------------------------------------

(Updated May 17, 2018, 1:06 a.m.)


Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.


Changes
-------

Rebased to the latest `master` branch.


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 (updated)
-----

  3rdparty/stout/include/stout/path.hpp 27438d31617b3b78bf3d4deffd25c93340610e8d 


Diff: https://reviews.apache.org/r/65811/diff/5/

Changes: https://reviews.apache.org/r/65811/diff/4-5/


Testing
-------


Thanks,

Jason Lai


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Jason Lai <ja...@jasonlai.net>.

> On May 14, 2018, 9:34 p.m., Andrew Schwartzmeyer wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 74 (patched)
> > <https://reviews.apache.org/r/65811/diff/4/?file=2018188#file2018188line74>
> >
> >     This should just be `is Abs = path::absolute(path)`. The function is already written, also only performs pure lexical processing, and is cross-platform.

Will address that in another update.


> On May 14, 2018, 9:34 p.m., Andrew Schwartzmeyer wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 77 (patched)
> > <https://reviews.apache.org/r/65811/diff/4/?file=2018188#file2018188line77>
> >
> >     ;)
> >     
> >     Given some unit to tests to prove it, I don't see a reason why this wouldn't handle Windows paths pretty much as-is. Maybe one extra step to convert `/` to `\` if the given separator is `\`. Since often "normalizing" on Windows also means converting slashes to something consistent (and we opt for `\` because of long paths).

Will do in a separate patch.


> On May 14, 2018, 9:34 p.m., Andrew Schwartzmeyer wrote:
> > 3rdparty/stout/include/stout/path.hpp
> > Lines 103-104 (patched)
> > <https://reviews.apache.org/r/65811/diff/4/?file=2018188#file2018188line103>
> >
> >     I guess, to make it cross platform, you'd want to save the original prefix (which could be a tad annoying), and then re-add it here.

Indeed. As said in a previous comment, will do that in a separate patch for cross platform support.


- Jason


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


On May 17, 2018, 1:06 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 17, 2018, 1:06 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/5/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>


Re: Review Request 65811: Add `path::normalize` to stout for normalizing path (for POSIX only now)

Posted by Andrew Schwartzmeyer <an...@schwartzmeyer.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65811/#review203072
-----------------------------------------------------------




3rdparty/stout/include/stout/path.hpp
Lines 74 (patched)
<https://reviews.apache.org/r/65811/#comment285146>

    This should just be `is Abs = path::absolute(path)`. The function is already written, also only performs pure lexical processing, and is cross-platform.



3rdparty/stout/include/stout/path.hpp
Lines 77 (patched)
<https://reviews.apache.org/r/65811/#comment285145>

    ;)
    
    Given some unit to tests to prove it, I don't see a reason why this wouldn't handle Windows paths pretty much as-is. Maybe one extra step to convert `/` to `\` if the given separator is `\`. Since often "normalizing" on Windows also means converting slashes to something consistent (and we opt for `\` because of long paths).



3rdparty/stout/include/stout/path.hpp
Lines 103-104 (patched)
<https://reviews.apache.org/r/65811/#comment285147>

    I guess, to make it cross platform, you'd want to save the original prefix (which could be a tad annoying), and then re-add it here.


- Andrew Schwartzmeyer


On May 8, 2018, 11:41 a.m., Jason Lai wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65811/
> -----------------------------------------------------------
> 
> (Updated May 8, 2018, 11:41 a.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 27438d31617b3b78bf3d4deffd25c93340610e8d 
> 
> 
> Diff: https://reviews.apache.org/r/65811/diff/4/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Jason Lai
> 
>