Giter Club home page Giter Club logo

Comments (12)

willwray avatar willwray commented on June 3, 2024 1

Thanks for the quick turnaround. I confirm that 2.0.10 fixes the issue on my windows runner.

btw, it should be straightforward to add windows runners to the new unit tests, by adding stategy: and matrix: levels to the workflow .yml, and with os: [ubuntu-latest, windows-latest] list:
https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs

Perhaps I should PR that.

from setup-git-credentials.

de-vri-es avatar de-vri-es commented on June 3, 2024 1

Cool, that saves us a lot of hassle. Thanks for the PR, and thanks again for the reporting, debugging and testing :D

from setup-git-credentials.

de-vri-es avatar de-vri-es commented on June 3, 2024

Interesting. This looks like it may be a problem with nodejs on Windows. But maybe we can avoid or fix it on our side. Do you have a full strack trace maybe? That would help a lot.

from setup-git-credentials.

willwray avatar willwray commented on June 3, 2024

Rerunning the failed action with 'enable debug logging' set doesn't give any more output than posted above
(in fact, the error seems to stop any stacktrace)

This may be useful:
https://developer.ibm.com/blogs/nodejs-15-release-blog/#updated-handling-of-rejections

You can avoid these warning messaging by handling the rejection with a catch block:

new Promise((resolve, reject) => {
reject('error');
}).catch((error) => {});

(A search on the error message has many similar hits, with similar conclusions)

from setup-git-credentials.

willwray avatar willwray commented on June 3, 2024

The error message Error: EPERM: operation not permitted, ftruncate
implicates lack of permission for the file.truncate

https://github.com/de-vri-es/setup-git-credentials/blob/main/src/main.ts#L30-L31

// Replace the entire file, so it doesn't matter if it ended with a newline before.
file.truncate(0);

from setup-git-credentials.

willwray avatar willwray commented on June 3, 2024

Found a clue here nodejs/node#3177

I thought that as long as you have the appropriate privileges and the file is opened for writing (not appending), you should be able to truncate it in either direction.

that was the problem. I had the file opened on Windows using "a+".

https://github.com/de-vri-es/setup-git-credentials/blob/main/src/main.ts#L26

const file = await fs.open(`${xdg_config_home()}/git/credentials`, "a+", 0o600);

Try opening with "w" write permissions?

from setup-git-credentials.

de-vri-es avatar de-vri-es commented on June 3, 2024

Ah, good point. The truncating was added later, but I forgot to update the file mode. Do you want to submit a PR to fix it? If not, I will fix it hopefully early this week.

Either way, thanks for the report and the additional information. I'm pretty sure you pinpointed the problem :D

from setup-git-credentials.

willwray avatar willwray commented on June 3, 2024

Thanks; this is a bit out of my wheel house so I'm happy to wait for a fix if and when you try it.
If it works on your cases without regression then I'll test it on my Windows actions and report back.

from setup-git-credentials.

de-vri-es avatar de-vri-es commented on June 3, 2024

Al-right, that sounds good! Thanks in advance for the testing. It will help a lot, since I don't have access to a windows machine.

from setup-git-credentials.

de-vri-es avatar de-vri-es commented on June 3, 2024

I've released 2.0.10 which no-longer truncates files, but simply only adds credentials that weren't already present.

Since there's no truncate anymore, I think this will also fix the problem on Windows.

from setup-git-credentials.

de-vri-es avatar de-vri-es commented on June 3, 2024

Awesome! Thanks for testing.

And a PR to test on windows would be most welcome. I'm also using a few POSIX command line utilities for the tests though, not sure how easy it would be to write that in a cross-platform way.

from setup-git-credentials.

willwray avatar willwray commented on June 3, 2024

PR #23 sketches a sufficiently cross-platform way - specifying shell: bash.
The windows runners execute on WSL which should be reasonably cross-platform
(the PR did, however, hit an issue with windows-vs-unix line endings
and we had already encountered the ftruncate difference here).

(In fact, unaware that the default shell is powershell, my github actions were already
running fine on Windows, using mesonbuild to test c++ projects)

from setup-git-credentials.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.