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:43:39 UTC
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/
-----------------------------------------------------------
(Updated May 8, 2018, 6:43 p.m.)
Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.
Changes
-------
Rename `path::clean` to `path::normalize`.
Bugs: MESOS-8257
https://issues.apache.org/jira/browse/MESOS-8257
Repository: mesos
Description
-------
Added an overloaded version of `os::realpath` to stout.
The new `os::realpath` function is used for evaluating real path
within a scoped root directory.
Diffs (updated)
-----
3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
Diff: https://reviews.apache.org/r/65812/diff/5/
Changes: https://reviews.apache.org/r/65812/diff/4-5/
Testing
-------
Thanks,
Jason Lai
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/#review203454
-----------------------------------------------------------
It's very hard to reason about the correctness of this patch without seeing thorough testing. Please include tests!
- Jie Yu
On May 17, 2018, 1:07 a.m., Jason Lai wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65812/
> -----------------------------------------------------------
>
> (Updated May 17, 2018, 1:07 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 an overloaded version of `os::realpath` to stout.
>
> The new `os::realpath` function is used for evaluating real path
> within a scoped root directory.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
>
>
> Diff: https://reviews.apache.org/r/65812/diff/6/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Jason Lai
>
>
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jason Lai <ja...@jasonlai.net>.
> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 51 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line51>
> >
> > Any reason we need this parameter here? Can we just remove this parameter, and use `os::PATH_SEPARATOR` below?
Done.
> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 65 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line65>
> >
> > No need for period for error messages.
Done
> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 88 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line88>
> >
> > No need to specify `_separator`?
Dropped.
> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 99 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line99>
> >
> > no need to specify `_separator` for both functions. They're the default value
Dropped.
> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 108-112 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line108>
> >
> > Let's add a stout helper `os::readlink`:
> >
> > ```
> > Try<string> readlink(const string& path);
> > ```
I added https://reviews.apache.org/r/68804/ as the wrapper for this.
> On May 18, 2018, 10:08 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 130 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line130>
> >
> > Ditto. No need for `_separator`
Dropped.
- Jason
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/#review203430
-----------------------------------------------------------
On May 17, 2018, 1:07 a.m., Jason Lai wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65812/
> -----------------------------------------------------------
>
> (Updated May 17, 2018, 1:07 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 an overloaded version of `os::realpath` to stout.
>
> The new `os::realpath` function is used for evaluating real path
> within a scoped root directory.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
>
>
> Diff: https://reviews.apache.org/r/65812/diff/6/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Jason Lai
>
>
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/#review203430
-----------------------------------------------------------
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 51 (patched)
<https://reviews.apache.org/r/65812/#comment285647>
Any reason we need this parameter here? Can we just remove this parameter, and use `os::PATH_SEPARATOR` below?
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 65 (patched)
<https://reviews.apache.org/r/65812/#comment285648>
No need for period for error messages.
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 88 (patched)
<https://reviews.apache.org/r/65812/#comment285678>
No need to specify `_separator`?
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 98-99 (patched)
<https://reviews.apache.org/r/65812/#comment285685>
Hum, consider this case:
```
path="/rootfs/bar"
root="/rootfs"
```
I was expecting the correct result to be `"/rootfs/bar"` (if I understand your function parameter correctly, if not, can you add more description for the parameters?)
Assuming that there's a symlink in the rootfs `/rootfs/rootfs -> /foo` (symlink).
When we process `"rootfs"` here (i.e., `component`), `normalizedPath == "/rootfs"`, and `fullPath == "/rootfs/rootfs"`. Since `/rootfs/rootfs` is a symlink, `linkPath` will be `"/foo"`. `"unprocessed"` will become `"/foo/bar"`.
Maybe the parameter `path` is scoped in the `root`? If that's the case, can you improve the function comments with more examples?
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 99 (patched)
<https://reviews.apache.org/r/65812/#comment285681>
no need to specify `_separator` for both functions. They're the default value
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 102-107 (patched)
<https://reviews.apache.org/r/65812/#comment285682>
you can use `os::stat::islink` here
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 108-112 (patched)
<https://reviews.apache.org/r/65812/#comment285683>
Let's add a stout helper `os::readlink`:
```
Try<string> readlink(const string& path);
```
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 130 (patched)
<https://reviews.apache.org/r/65812/#comment285679>
Ditto. No need for `_separator`
- Jie Yu
On May 17, 2018, 1:07 a.m., Jason Lai wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65812/
> -----------------------------------------------------------
>
> (Updated May 17, 2018, 1:07 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 an overloaded version of `os::realpath` to stout.
>
> The new `os::realpath` function is used for evaluating real path
> within a scoped root directory.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
>
>
> Diff: https://reviews.apache.org/r/65812/diff/6/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Jason Lai
>
>
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jason Lai <ja...@jasonlai.net>.
> On May 18, 2018, 10:12 p.m., Jie Yu wrote:
> > 3rdparty/stout/include/stout/os/posix/realpath.hpp
> > Lines 68-81 (patched)
> > <https://reviews.apache.org/r/65812/diff/6/?file=2024593#file2024593line68>
> >
> > IN fact, I would consider making `unprocessed` a `vector<string>` (which is a result of `tokenize`)
> >
> > I understand you want to reset `unprocessed` below, you can still do one more `tokenize` there to avoid the complex substr logic here.
I tried with a local rewritten version per your suggestion, but it actually turned out to be a bit more complex and added perf overhead to this version.
We simply need to split `unprocessed` into 0 up to 2 elements and the logic seems pretty intuitive here.
- Jason
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/#review203455
-----------------------------------------------------------
On May 17, 2018, 1:07 a.m., Jason Lai wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65812/
> -----------------------------------------------------------
>
> (Updated May 17, 2018, 1:07 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 an overloaded version of `os::realpath` to stout.
>
> The new `os::realpath` function is used for evaluating real path
> within a scoped root directory.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
>
>
> Diff: https://reviews.apache.org/r/65812/diff/6/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Jason Lai
>
>
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jie Yu <yu...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/#review203455
-----------------------------------------------------------
3rdparty/stout/include/stout/os/posix/realpath.hpp
Lines 68-81 (patched)
<https://reviews.apache.org/r/65812/#comment285687>
IN fact, I would consider making `unprocessed` a `vector<string>` (which is a result of `tokenize`)
I understand you want to reset `unprocessed` below, you can still do one more `tokenize` there to avoid the complex substr logic here.
- Jie Yu
On May 17, 2018, 1:07 a.m., Jason Lai wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65812/
> -----------------------------------------------------------
>
> (Updated May 17, 2018, 1:07 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 an overloaded version of `os::realpath` to stout.
>
> The new `os::realpath` function is used for evaluating real path
> within a scoped root directory.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
>
>
> Diff: https://reviews.apache.org/r/65812/diff/6/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Jason Lai
>
>
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/
-----------------------------------------------------------
(Updated Nov. 7, 2018, 9:23 p.m.)
Review request for mesos, 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 an overloaded version of `os::realpath` to stout.
The new `os::realpath` function is used for evaluating real path
within a scoped root directory.
Diffs (updated)
-----
3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
Diff: https://reviews.apache.org/r/65812/diff/8/
Changes: https://reviews.apache.org/r/65812/diff/7-8/
Testing
-------
Thanks,
Jason Lai
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/
-----------------------------------------------------------
(Updated Sept. 21, 2018, 10:45 p.m.)
Review request for mesos, Eric Chung, Gilbert Song, Jie Yu, James Peach, and Zhitao Li.
Changes
-------
Address review comments from @jieyu.
Bugs: MESOS-8257
https://issues.apache.org/jira/browse/MESOS-8257
Repository: mesos
Description
-------
Added an overloaded version of `os::realpath` to stout.
The new `os::realpath` function is used for evaluating real path
within a scoped root directory.
Diffs (updated)
-----
3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
Diff: https://reviews.apache.org/r/65812/diff/7/
Changes: https://reviews.apache.org/r/65812/diff/6-7/
Testing
-------
Thanks,
Jason Lai
Re: Review Request 65812: Added an overloaded version of
`os::realpath` to stout
Posted by Jason Lai <ja...@jasonlai.net>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65812/
-----------------------------------------------------------
(Updated May 17, 2018, 1:07 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
-------
Added an overloaded version of `os::realpath` to stout.
The new `os::realpath` function is used for evaluating real path
within a scoped root directory.
Diffs (updated)
-----
3rdparty/stout/include/stout/os/posix/realpath.hpp 31352cefc5b8d0ccd9af8f6dabdec4a959fded32
Diff: https://reviews.apache.org/r/65812/diff/6/
Changes: https://reviews.apache.org/r/65812/diff/5-6/
Testing
-------
Thanks,
Jason Lai