File deletion exception (OD-1334)
Closed
Colin Xu opened 1 year ago

When the system tries to clear the workspace, it mistakes a directory for a file and attempts to delete it, resulting in an exception being thrown as shown in the screenshot below.

image.png

I confirm that ISSUE_TEMPLATE is a directory and not a file.

Robin Shen commented 1 year ago

Although the method name is deleteFile, it also handles deletion of a directory after cleaning it up. Can you please attach a sampe repo to demonstrate the issue?

Colin Xu commented 1 year ago

Steps to reproduce:

  1. Import the repository using the URL https://github.com/Yidadaa/ChatGPT-Next-Web.git.
  2. Create a Server Shell Executor.
  3. Add a pipeline for this imported project and set the executor as the Server Shell Executor created in step 2.
  4. Add a "Checkout Code" step to the pipeline, then run the job.
Robin Shen commented 1 year ago

Still works at my side. Are you able to reproduce this every time? On which platform OneDev is running?

Colin Xu commented 1 year ago

Yes, it can be reproduced every time. OneDev is running in an LXC virtual machine on PVE, and the virtual machine system is Debian 11.

When the Executor is a Docker Executor, everything works fine.

The following is an exception build log file.

build-log.txt

Robin Shen commented 1 year ago

I do not have that enviroment. Just tested on a EC2 debian VM and everything works fine. I guess LXC@PVE does not make any difference in this regard. Are you sure you can reproduce this with the simple setup?

Colin Xu commented 1 year ago

It may be an issue with character encoding. The files with English file names in the same directory were deleted, leaving only two files with Chinese file names. When I tested it on a problematic machine, the file names read as garbled characters.

The screenshot below shows the result I obtained from debugging and the original file name.

image_2.png

image_3.png

This is why these two files cannot be deleted. Can we call the system command to delete again if deletion fails?

Robin Shen commented 1 year ago

Looks like your machine is not using UTF-8 as the default encoding. Changing OneDev to resort to system delete command in this case hurts its cross-platform ability, and also you may have other troubles such as publishing artifacts/reports from files.

I'd suggest to correct encoding of your machine. There are a number of ways to do that, and a simple approach is to specify environment variable LANG as en_US.UTF-8.

Colin Xu commented 1 year ago

Yes, you are correct. I changed the system character encoding and the issue was resolved. Thank you.

Robin Shen changed state to 'Closed' 1 year ago
Previous Value Current Value
Open
Closed
issue 1 of 1
Type
Bug
Priority
Major
Assignee
Affected Versions
Versions 8.0.15 and below
Issue Votes (0)
Watchers (4)
Reference
OD-1334
Please wait...
Page is in error, reload to recover