Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realpath: add -L and -P command-line arguments #2541

Closed

Conversation

jfinkels
Copy link
Collaborator

This is my second attempt at adding these, see pull request #2530. (In this one I have tried to minimize the changes to uucore::fs to only the changes required to get the new features to work.)

Partially resolves issue #2253.

This pull request adds the -L (logical) and -P (physical) command-line arguments to realpath. The -L option makes the program resolve ".." components before symbolic links. The -P option makes the program resolve symbolic links as they are encountered. This also changes the default behavior of realpath from the -L behavior to the -P behavior. This matches the behavior of GNU realpath. I don't fully understand all the things that -L is supposed to do, but this is a start, and seems to match the basic tests in the GNU coreutils test suite.

jfinkels added 2 commits July 31, 2021 19:14
Add the `logical` argument to the `uucore::fs::canonicalize()`
function. This argument controls whether symbolic links are resolved
before or after ".." components are resolved.
Add the `-L` (logical) and `-P` (physical) command-line arguments to
`realpath`. The `-L` option makes the program resolve ".." components
before symbolic links. The `-P` option makes the program resolve
symbolic links as they are encountered.

This also changes the default behavior of `realpath` from the `-L`
behavior to the `-P` behavior. This matches the behavior of GNU
`realpath`.
@sylvestre
Copy link
Contributor

I guess you saw that some of the windows tests are failing


    test_realpath::test_logical
    test_realpath::test_logical_overrides_physical
    test_realpath::test_physical
    test_realpath::test_physical_default
    test_realpath::test_physical_overrides_logical

Copy link
Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs tests to be fixed

@miDeb
Copy link
Contributor

miDeb commented Aug 21, 2021

Well... I just merged #2459 which basially implemented the same feature. I wasn't aware that this PR existed as well. Is there a difference in functionality between this PR and the other one? Maybe we can at least keep the tests from this PR.

@jfinkels
Copy link
Collaborator Author

Is there a difference in functionality between this PR and the other one? Maybe we can at least keep the tests from this PR.

I don't think there is a difference in functionality. It looks like that other pull request was able to resolve the Windows issues I was having here. The only additional test cases in this pull request are for -L overriding -P, and vice versa, which doesn't seem all that valuable. But I can add them in a new pull request if desired. Otherwise, I'm just going to close this.

@jfinkels jfinkels closed this Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants