Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renovate cleanRepository fails when repo contains files with special characters #3933

Closed
svenbs opened this issue Jun 13, 2019 · 11 comments
Closed
Assignees
Labels
help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@svenbs
Copy link

svenbs commented Jun 13, 2019

What Renovate type are you using?
Renovate CLI

Describe the bug
If a repo contains files with special encoded characters, the cleanupRepository() or remove() calls will fail with ENOTEMPTY error, as it could not delete the files with special characters in it.

e.g some file like this: ''$'\334''dokument_V1.3_Java7.doc'

Did you see anything helpful in debug logs?

 INFO: Repository is disabled - skipping (repository=redacted)
FATAL: Fatal error: ENOTEMPTY: directory not empty, rmdir '/tmp/renovate/repos/gitlab/redacted/data/' (repository=xyz)
       "err": {
         "errno": -39,
         "code": "ENOTEMPTY",
         "syscall": "rmdir",
         "path": "/tmp/renovate/repos/gitlab/redacted/data",
         "message": "ENOTEMPTY: directory not empty, rmdir '/tmp/renovate/repos/gitlab/redacted/data'",
         "stack": "Error: ENOTEMPTY: directory not empty, rmdir '/tmp/renovate/repos/gitlab/redacted/data'"
       }

To Reproduce
Steps to reproduce the behavior:

  1. Create repository and touch a file like this: touch '''$'\334''testfile''
  2. Configure { "enabled": false } in the renovate.json, so the repo will be skipped and renovate tries to delete it.

Expected behavior
The repo should get deleted and renovate should move on to the next repo.

@rarkins rarkins added type:bug Bug fix of existing functionality priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others ready labels Jul 22, 2019
@rarkins rarkins added the good first issue Suitable for new contributors label Jul 30, 2019
@rakeshtembhurne
Copy link
Contributor

@svenbs Could you please share your system details, like OS, node, npm/yarn, git versions where you faced these issues? I am trying to replicate this but seems to be working on my system.

@rakeshtembhurne
Copy link
Contributor

The issue appears to be with fs-extra npm package.

const fs = require('fs-extra');
// ...
await fs.remove(config.localDir);

It appears that there is a known issue (jprichardson/node-fs-extra#575) related to non utf8 characters in files names for linux platforms.

@rarkins
Copy link
Collaborator

rarkins commented Aug 13, 2019

To gauge how important this is, I'd like to know:

  • Are these types of filenames OK with git?
  • Are these types of filenames OK with github.com?

And if the answer is yes to both then we need to look if there's any other solution for removing directories with such contents.

@rarkins rarkins removed the ready label Jun 18, 2020
@rarkins
Copy link
Collaborator

rarkins commented Aug 25, 2020

I'm seeing this issue more frequently in the app. Wondering if rimraf handles it better

@rarkins rarkins self-assigned this Aug 25, 2020
@rarkins
Copy link
Collaborator

rarkins commented Aug 25, 2020

When attempting to test one such repo locally, I found that git failed to clone it to my mac. So perhaps you need a Linux fs to start with.

@rarkins rarkins removed their assignment Aug 25, 2020
@rarkins rarkins added help wanted Help is needed or welcomed on this issue and removed good first issue Suitable for new contributors labels Aug 25, 2020
@rarkins
Copy link
Collaborator

rarkins commented Aug 25, 2020

@olegkrivtsov
Copy link
Contributor

I'd like to take this one.

@rarkins rarkins assigned olegkrivtsov and unassigned yoswein Nov 11, 2021
@olegkrivtsov
Copy link
Contributor

My plan for fixing this issue:

  1. Edit lib/workers/repository/index.ts:

if (localDir && !config.persistRepoData) {
try {
await deleteLocalFile('.');
} catch (err) /* istanbul ignore if */ {
logger.warn({ err }, 'localDir deletion error');
}
}

This block deletes the repo directory after repo was processed. I think I need to replace the call to deleteLocalFile() with rimraf(): https://www.npmjs.com/package/rimraf From the docs it looks like rimraf works on any OS, so I'd just call it without any OS checks.

Could you please tell me if that look like a good plan?

@rarkins
Copy link
Collaborator

rarkins commented Nov 12, 2021

Can you reproduce the problem?

@olegkrivtsov
Copy link
Contributor

Hi @rarkins I tried to reproduce on this repo: https://github.com/olegkrivtsov/renovate-special-chars

I created several test files with special chars and tried to run Renovate in Linux Ubuntu 20.04 with {enabled: true} and {enabled:false}. But it worked as expected, I see no errors.

What OS should I use for reproducing? I guess Linux?

@rarkins
Copy link
Collaborator

rarkins commented Nov 12, 2021

Let's close until we can get a working reproduction

@rarkins rarkins closed this as completed Nov 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

5 participants