open-telemetry / open-telemetry/opentelemetry-python-contrib

Invalid cross-device link when running tox -e generate

Open
#716 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Describe your environment

Using Python 3.9 on linux, the only interesting part is that my /tmp and the repo checkout are on different filesystems.

Steps to reproduce

Run tox -e generate

What is the expected behavior?
A working script

What is the actual behavior?

Traceback (most recent call last):
  File "/home/michael/work/opentelemetry-python-contrib/scripts/generate_instrumentation_bootstrap.py", line 120, in <module>
    compare()
  File "/home/michael/work/opentelemetry-python-contrib/scripts/generate_instrumentation_bootstrap.py", line 114, in compare
    os.replace(gen_path, "bootstrap_gen.py")
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmphlewuek9/new.py' -> 'bootstrap_gen.py

Additional context
I worked around it by adding a line to tox.ini to set $TMP to a directory on the same filesystem. Wouldn't surprise me if others have seen this issue. Not sure if anyone has a preferred way of fixing it - this clearly isn't, probably fixing the os.replace() call with a copy would work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/generate_instrumentation_bootstrap.py, especially compare() around the os.replace call at line 114, then inspect tox.ini and run tox -e generate with /tmp and the repository on different filesystems. Done means the generation script completes and produces a working bootstrap_gen.py without the cross-device link error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.