Skip to content

Commit

Permalink
Merge pull request #1233 from a3f/managedfile-nfs-realpath
Browse files Browse the repository at this point in the history
util/managedfile: resolve symlinks before comparing NFS paths
  • Loading branch information
Emantor committed Aug 1, 2023
2 parents ccbcffb + 2202807 commit 4118f6b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Bug fixes in 23.1
labgrid-client.
- Fix sftp option issue in SSH driver that caused sftp to only work once per
test run.
- ManagedFile NFS detection heuristic now does symlink resolution on the
local host.

Breaking changes in 23.1
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion labgrid/util/managedfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ManagedFile:
"""
local_path = attr.ib(
validator=attr.validators.instance_of(str),
converter=lambda x: os.path.abspath(str(x))
converter=lambda x: os.path.realpath(str(x))
)
resource = attr.ib(
validator=attr.validators.instance_of(Resource),
Expand Down
3 changes: 2 additions & 1 deletion tests/test_flashscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import subprocess
import tempfile
import attr
import os
from pathlib import Path
from labgrid.driver.flashscriptdriver import FlashScriptDriver
from labgrid.resource.common import ManagedResource
Expand Down Expand Up @@ -69,4 +70,4 @@ def test_argument_device_expansion(target, resource, driver):

def test_argument_file_expansion(target, driver):
value = capture_argument_expansion(driver, "file.local_path")
assert value == "/bin/sh"
assert os.path.samefile(value, "/bin/sh")

0 comments on commit 4118f6b

Please sign in to comment.