Git Product home page Git Product logo

Comments (17)

spenserblack avatar spenserblack commented on May 28, 2024 1

In my attempts to recreate this, I made a config (path = fakepath) and removed read and write permissions from that file. Both onefetch and git itself failed due to being unable to read the file.

@ms-boom Does git itself raise a permission error? If not, could you give us steps to take to reproduce this error?

from onefetch.

spenserblack avatar spenserblack commented on May 28, 2024 1

For the sake of completeness, do we want to see the file stats of onefetch? (ls -l "$(which onefetch)")

from onefetch.

spenserblack avatar spenserblack commented on May 28, 2024

🤔

I wonder if this stems from git2 or gix (cc @Byron).

from onefetch.

Byron avatar Byron commented on May 28, 2024

Thanks for the heads-up!

What does Git do in the same situation? I presume it just works? Or does it print anything? Also, which platform are you on and which version of onefetch are you using?

gitoxide will resolve such includes and I assume it could find .gitconfig-projects and failed to read it due to a permission denied error, which is something the git program should surface as well.

I think what could be done here is that gitoxide can be taught to be allowed to ignore errors during includes-processing, but doing so would still be the decision of onefetch, the governing application. It will definitely help to see what git does here.

Thanks for your help.

from onefetch.

ms-boom avatar ms-boom commented on May 28, 2024

I use

git version 2.34.1

onefetch 2.19.0

OS: Ubuntu 22.04.4 LTS

full example of .gitconfig:

[pull]
rebase = true

[includeIf "gitdir:~/projects/work/"]
path = .gitconfig-work

[includeIf "gitdir:~/projects/pet-projects/"]
path = .gitconfig-pet-projects

[core]
        editor = vim

This is correct for Git. Everything is fine with file permissions too. I use this configuration at work.

If i remove options with "includeIf" onefetch works fine.
The error is reproduced even if .gitconfig-work and .gitconfig-pet-projects are empty. So it looks like the problem is in the includeIf option.

from onefetch.

spenserblack avatar spenserblack commented on May 28, 2024

Sorry, I mean a way to recreate the file permissions so we can test this out. Could you try running this?

ls -l ~/.gitconfig ~/.gitconfig-projects ~/.gitconfig-work ~/.gitconfig-pet-projects

from onefetch.

Byron avatar Byron commented on May 28, 2024

That's true, thus far we can only reproduce the variant where both onefetch and git have trouble reading the include file, but not what you are describing unfortunately.

Seeing the result of the line proposed by @spenserblack would be very helpful.

The error is reproduced even if .gitconfig-work and .gitconfig-pet-projects are empty. So it looks like the problem is in the includeIf option.

It would always try to read them which seems to be the problem. But it should be a problem for git as well, but maybe git has special permissions, like the SUID bit set?

Maybe let's extend the line above to:

ls -l ~/.gitconfig ~/.gitconfig-projects ~/.gitconfig-work ~/.gitconfig-pet-projects "$(which git)"

from onefetch.

ms-boom avatar ms-boom commented on May 28, 2024
ls -l ~/.gitconfig ~/.gitconfig-projects ~/.gitconfig-work ~/.gitconfig-pet-projects "$(which git)"
-rw-rw-r-- 1 ms-boom ms-boom     254 Feb 22 20:37 /home/ms-boom/.gitconfig
-rw-rw-r-- 1 ms-boom ms-boom     243 Jan 29 21:27 /home/ms-boom/.gitconfig-pet-projects
-rw-rw-r-- 1 ms-boom ms-boom     220 Jan 10 15:32 /home/ms-boom/.gitconfig-work
-rwxr-xr-x 1 root     root     3702168 Jul  7  2023 /usr/bin/git

from onefetch.

Byron avatar Byron commented on May 28, 2024

Thanks a lot! It doesn't look like git is actually run as root, so onefetch and git should have the same permissions when launched. Yet, onefetch can't read a file and probably fails right here when opening a configuration file it determined exists.

And for that I have no explanation except if onefetch would find a file that git doesn't actually find. But at this time there is no facility to debug this.

If you would be willing to get a local developer setup I could provide patches for gitoxide that would help shed some light. It's not incredibly involved, but would have you clone onefetch, clone gitoxide, create configuration in onefetch for it to use the local version of gitoxide, and then apply various patches to that local clone to try onefetch against.

Without that remote debugging, and without being able to reproduce that locally (i.e. Git works but onefetch fails), I don't think there is more I can do.

Please let me know @ms-boom if you want to try such remote debugging with me.

from onefetch.

Related Issues (20)

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.