labgrid-project / labgrid-project/labgrid

Username and Hostname with / break labgrid usage

Open
#824 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue
Dominant language
Python
Stars
528
Forks
278
Avg merge
2d 19h
Merged PRs (30d)
4

Description

Hi,

Setup
I'm running labgrid-cooridnator with a self build docker image which uses the master branch
https://github.com/labgrid-project/labgrid/commit/41b297faba60f32e4986678554af32dbff83ce98
I checked this by running git logs on /opt/labgrid within the container.

For connecting to the coordinator I'm using the official image from hub.docker.com:
labgrid/client@sha256:c2808c805d6e14505b5050a1cb493ea1e4ecad81bbde8ce5aaadab0d6cdb8667

Description

If one of the environment variables LG_USERNAME or LG_HOSTNAME contain a /, I'm not able to unlock a reserved place (labgrid-client -p + unlock), nor show the current usage (labgrid-client who).

Procedure

# export LG_USERNAME="user/123"
# export LG_HOSTNAME="host/123"
# labgrid-client places
  p1
# labgrid-client -v places
Place 'p1':
  tags: test=123
  matches:
  acquired: None
  acquired resources:
  created: 2021-08-17 14:54:11.289673
  changed: 2021-09-03 09:15:49.538910
# labgrid-client reserve --shell test=123 > labgrid-token.sh
# source ./labgrid-token.sh
# labgrid-client wait
owner: host/123/user/123
token: SMILMTLDAN
state: allocated
filters:
  main: test=123
allocations:
  main: p1
created: 2021-09-03 09:34:41.672340
timeout: 2021-09-03 09:36:01.812984
# labgrid-client -p + lock
acquired place p1
# labgrid-client -p + show
Place 'p1':
  tags: test=123
  matches:
  acquired: host/123/user/123
  acquired resources:
  created: 2021-08-17 14:54:11.289673
  changed: 2021-09-03 09:37:09.926147
  reservation: SMILMTLDAN

Errors

# labgrid-client who
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/labgrid-0.1.dev1+g41b297f-py3.7.egg/labgrid/remote/client.py", line 1843, in main
    args.func(session)
  File "/usr/local/lib/python3.7/dist-packages/labgrid-0.1.dev1+g41b297f-py3.7.egg/labgrid/remote/client.py", line 272, in print_who
    host, user = place.acquired.split('/')
ValueError: too many values to unpack (expected 2)

# labgrid-client -p + unlock
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/labgrid-0.1.dev1+g41b297f-py3.7.egg/labgrid/remote/client.py", line 1841, in main
    session.loop.run_until_complete(coro)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.7/dist-packages/labgrid-0.1.dev1+g41b297f-py3.7.egg/labgrid/remote/client.py", line 629, in release
    _, user = place.acquired.split('/')
ValueError: too many values to unpack (expected 2)

Personal Conclusion

From what I understand, a / should not be allowed in the username or hostname.

Contributor guide

No contributing guide indexed for this repository

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 in labgrid/remote/client.py at print_who and release, the traceback locations for labgrid-client who and unlock. Reproduce with LG_USERNAME and LG_HOSTNAME containing '/', then inspect how the acquired value is formed and consumed. Done means these commands no longer fail for such values, consistent with the issue's proposed username and hostname constraint.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.