MarketSquare / MarketSquare/robotframework-archivelibrary

bug in os.path.join

Open
#28 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
21
Forks
24
PR merge metrics
No merged PRs in 30d

Description

In ‘utils.py’,

Line 22    curdir = os.path.join(basedir, dir)
Line 42    outfile = open(os.path.join(dest, name), 'wb')

When I unzip a file which has a path in it,

unzip

The case fails. “OSError: [Errno 13] Permission denied: '/ram'”
That’s because the method ‘os.path.join’ does not work as we expect.
For example:

>>> basedir = '/home/ute/ta_kiss_files/example/BTS9_1011_CCNTrace'
>>> dir = '/ram'
>>> curdir = os.path.join(basedir, dir)
>>> print curdir
/ram

After I change the utils.py as below,

Line 22    curdir = os.path.join(basedir, dir)
Change to  curdir = basedir + '/' + dir
Line 42    outfile = open(os.path.join(dest, name), 'wb')
Change to  outfile = open(dest + '/' + name, 'wb')

Case passes, because,

>>> curdir = basedir + '/' + dir
>>> print curdir
/home/ute/ta_kiss_files/example/BTS9_1011_CCNTrace///ram
>>>

That is what we expect.

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 in utils.py at the path construction on lines 22 and 42, then reproduce extraction with an archive entry containing an absolute path such as /ram. Check how the destination and archive member names are combined, and verify that the completed behavior extracts into the requested destination without attempting to write to /ram.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.