-
Notifications
You must be signed in to change notification settings - Fork 93
copy_in creates directory when destination is a file path #238
Copy link
Copy link
Closed
Description
Description
copy_in("/host/file.py", "/guest/file.py") creates a directory named file.py at the destination instead of copying the file. The user must use a directory destination with trailing slash: copy_in("/host/file.py", "/guest/").
Reproduction
import asyncio, os, boxlite
async def main():
os.makedirs("/tmp/test_copy", exist_ok=True)
with open("/tmp/test_copy/script.py", "w") as f:
f.write("print('hello')\n")
async with boxlite.SimpleBox(image="python:slim") as box:
await box.exec("mkdir", "-p", "/workspace")
# Copy file to file path (as documentation shows)
await box.copy_in("/tmp/test_copy/script.py", "/workspace/script.py")
result = await box.exec("ls", "-la", "/workspace/")
print(result.stdout)
# Shows: drwxr-xr-x 2 root root 4096 ... script.py ← directory!
asyncio.run(main())Expected
/workspace/script.py is a regular file containing the script content.
Actual
/workspace/script.py is a directory (tar extraction creates dir for the archive entry).
Workaround
Use a directory destination:
await box.copy_in("/tmp/test_copy/script.py", "/workspace/")
# Now /workspace/script.py is a file ✓Environment
- boxlite 0.5.10
- macOS Apple Silicon
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels