Skip to content

UnauthorizedAccessException when running on Linux #3

@jmezach

Description

@jmezach

I recently tried running this module on a hosted Linux agent and the good news is that it works, almost. I'm getting an UnauthorizedAccessException: Access to the path '/' is denied. The exception makes sense of course, but the question is why it is writing things to root. I had a look at the logs and this is what I'm seeing:

VERBOSE: received 390-byte response of content type application/json
VERBOSE: Received <redacted>
VERBOSE: Creating output folder: '/home/vsts/work/_temp/TestResults'
VERBOSE: GET https://dev.azure.com/<org>/<team-project>/_apis/test/Runs/1594766/attachments?api-version=5.0-preview.1 with 0-byte payload
VERBOSE: received 389-byte response of content type application/json
VERBOSE: Received <redacted>
VERBOSE: Downloading 'https://dev.azure.com/<org>/<team-project>/_apis/test/Runs/1594766/Attachments/1' to '/home/vsts/work/_temp/TestResults/_fv-az104_2020-09-16_09_45_15.trx'
VERBOSE: GET https://dev.azure.com/<org>/<team-project>/_apis/test/Runs/1594766/Attachments/1 with 0-byte payload
VERBOSE: received -byte response of content type application/octet-stream
VERBOSE: Downloading TRX: _fv-az104_2020-09-16_09_45_15.trx
VERBOSE: Configuring TRX folder: /home/vsts/work/_temp/TestResults/_fv-az104_2020-09-16_09_45_15
VERBOSE: Processing attachments
VERBOSE: fv-az104/coverage.cobertura.xml  => fv-az104
VERBOSE: The file 'coverage.cobertura.xml' will be stored at '/home/vsts/work/_temp/TestResults/_fv-az104_2020-09-16_09_45_15/In/fv-az104'
VERBOSE: Creating output location: '/home/vsts/work/_temp/TestResults/_fv-az104_2020-09-16_09_45_15/In/fv-az104'
VERBOSE: Downloading coverage.cobertura.xml
VERBOSE: Writing coverage.cobertura.xml to /
VERBOSE: Downloading 'https://dev.azure.com/<org>/<team-project>/_apis/test/Runs/1594766/Attachments/3' to '/'
VERBOSE: GET https://dev.azure.com/<org>/<team-project>/_apis/test/Runs/1594766/Attachments/3 with 0-byte payload
VERBOSE: received -byte response of content type application/octet-stream
VERBOSE: System.UnauthorizedAccessException: Access to the path '/' is denied.

Looking at the code it seems that this is where things started to go wrong. For some reason the targetLocations variable there doesn't have a value, causing the output folder to be /. Haven't managed to dig any deeper than that. Running the exact same thing works as expected on Windows, so it's probably a silly platform specific thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions