GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Mounted: add path resolution · Issue #27 · moby/sys

Mounted: add path resolution #27

New issue
Copy link
New issue
Copy link
Closed
#29
Closed
Mounted: add path resolution#27
#29
Copy link

Description

@kolyshkin
kolyshkin
opened on Aug 27, 2020
Issue body actions

The argument to mount.Mounted call needs to be an absolute path with symlinks resolved and cleaned (otherwise it won't match the path in mountinfo). Currently, it is a caller's duty to make sure the path is prepared. I am thinking into moving this functionality into the library, because

  1. if the path is already prepared, this won't affect performance much (it's a few stat(2) syscalls);
  2. if the path is not prepared and is resolved correctly, we avoid "false negative".

The implementation of 'resolve' is something like this:

        if realPath, err = filepath.Abs(path); err != nil {
                return false, fmt.Errorf("unable to get absolute path for %q: %w", path, err)
        }
        if realPath, err = filepath.EvalSymlinks(realPath); err != nil {
                return false, fmt.Errorf("failed to canonicalise path for %q: %w", path, err)
        }
        if _, err := os.Stat(realPath); err != nil {
                return false, fmt.Errorf(err, "failed to stat target %q of %q: %w", realPath, path, err)
        }

Activity

  1. kolyshkin commented on Aug 27, 2020

    @kolyshkin
    kolyshkin
    on Aug 27, 2020
    CollaboratorAuthor
    More actions

    NOTE that we already stat the target, so the addition of the above function won't help us to return early in case path is non-existent.

  2. kolyshkin commented on Aug 27, 2020

    @kolyshkin
    kolyshkin
    on Aug 27, 2020
    CollaboratorAuthor
    More actions

    Also, we can't do the same "resolve" for mount filters as there are no way to return an error from a filter, so the caller is still responsible.

  3. thaJeztah
    closed this as completedin #29on Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.