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

Snap version 2.11.0 fail to run #588

Closed
Czaki opened this issue Feb 21, 2022 · 20 comments
Closed

Snap version 2.11.0 fail to run #588

Czaki opened this issue Feb 21, 2022 · 20 comments

Comments

@Czaki
Copy link

Czaki commented Feb 21, 2022

When trying to use onefetch from snap its fails with Error: please run onefetch inside of a non-bare git repository

$ onefetch --help                                                         
onefetch 2.11.0

When using version from apt everything works

$ onefetch --help   
onefetch 2.10.2

My system:

$ lsb_release -a 
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.10
Release:	21.10
Codename:	impish  
@Czaki Czaki changed the title Snap version fail to run Snap version 2.11.0 fail to run Feb 21, 2022
@o2sh
Copy link
Owner

o2sh commented Feb 21, 2022

When trying to use onefetch from snap its fails with Error: please run onefetch inside of a non-bare git repository

Are you sure that you ran onefetch inside of a git repository? see the Getting Started section in the wiki.

@Czaki
Copy link
Author

Czaki commented Feb 21, 2022

Are you sure that you ran onefetch inside of a git repository? see the Getting Started section in the wiki.

Yes. I run both version in same repository. I'm not only one:

https://www.reddit.com/r/linux/comments/sxarym/neofetch_for_git_repository/hxszgzn/?utm_source=reddit&utm_medium=web2x&context=3

@o2sh
Copy link
Owner

o2sh commented Feb 21, 2022

Indeed, you're not the first one to have encountered this issue #335

Unfortunately, I can't reproduce on my machine.

@Czaki
Copy link
Author

Czaki commented Feb 21, 2022

Did you have any hint how I could got more verbose output that may help you? Maybe this is somehow related to snap permissions?

@spenserblack
Copy link
Collaborator

I think we may want to adjust this line

Ok(repo.is_ok() && !repo?.is_bare())

When repo.is_ok() is false, it's likely short-circuiting the boolean expression, resulting in Ok(false) being returned when the wanted behavior is likely that !repo?.is_bare() would return an Error (due to the ?). This is likely leading to confusing errors that aren't due to the repo being bare.

@Czaki
Copy link
Author

Czaki commented Feb 22, 2022

I just compile onefetch from the source and it works without problem.

When building snap using snapcraft it also works. So modifying code also will not help to solve this.

But when install from snap store it does not work.

@spenserblack
Copy link
Collaborator

spenserblack commented Feb 22, 2022

This is just a guess, but I'm thinking maybe the snap store version isn't properly linking with some libraries, which causes repo.is_ok to return false.

Edit: Likely related to #335

@Czaki
Copy link
Author

Czaki commented Feb 22, 2022

there are no such error messages.
Maybe it is possible to create a new snap release (maybe using a beta channel) to check this? Or some more verbose version that will print additional debug information?

@spenserblack
Copy link
Collaborator

spenserblack commented Feb 22, 2022

there are no such error messages.

Sorry, I didn't mean that you're getting that specific error, just that it's likely that the error is caused by a failure to link to a library. But, due to boolean short-circuiting, that error is silently ignored.

Here is an example that I hope clarifies why the error you're seeing isn't actually the root cause. Either way I would consider this a bug where onefetch is hiding the appropriate error message.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9ca3f3493109fd43478394b29559d1c6

@Czaki
Copy link
Author

Czaki commented Feb 22, 2022

I see. Maybe @o2sh could create a new release that will allow debugging this.

@o2sh
Copy link
Owner

o2sh commented Feb 22, 2022

I followed @spenserblack's suggestion and temporarily removed the first condition in the is_valid() check.

@Czaki, you can test this version via sudo snap install onefetch --edge

@Czaki
Copy link
Author

Czaki commented Feb 22, 2022

$ onefetch ../PartSeg              
Error: failed open - '/etc/gitconfig' is locked: Permission denied; class=Os (2); code=Locked (-14)                                                                                                                                                              /0,3s

where

$ cat /etc/gitconfig
[filter "lfs"]
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
	clean = git-lfs clean -- %f  

Based on fast google it may be connected with install git-lfs and by default, this file is absent in most installations.
Later I read that snap by default has to access only files in the user home directory.

I found a similar issue profclems/glab#597 with a simple solution profclems/glab#599

@Czaki
Copy link
Author

Czaki commented Feb 27, 2022

I see your message yesterday evening, but when try to test it today it is missed. So I cannot check if it works.

@o2sh
Copy link
Owner

o2sh commented Feb 27, 2022

Yeah sorry, I thought I had a solution but I was wrong 😞

As a quick and easy fix, would you consider making your gitconfig global wide instead of system wide -> mv /etc/gitconfig ~/.gitconfig ?

@Czaki
Copy link
Author

Czaki commented Feb 27, 2022

As a quick and easy fix, would you consider making your gitconfig global wide instead of system wide -> mv /etc/gitconfig ~/.gitconfig ?

This will fix of course. For me, I could even use the compiled version. But this is not a proper solution for his problem.
And it is not a solution for all users where sometimes you need systemwide configuration files for all users. There need to be at least some proper error message.

@o2sh
Copy link
Owner

o2sh commented Feb 27, 2022

Following 125c610, a manual review was automatically created and is currently pending: https://dashboard.snapcraft.io/snaps/onefetch/revisions/1855/

@o2sh
Copy link
Owner

o2sh commented Mar 2, 2022

https://forum.snapcraft.io/t/system-files-request-for-onefetch/28963

o2sh added a commit that referenced this issue Mar 17, 2022
o2sh added a commit that referenced this issue Mar 18, 2022
o2sh added a commit that referenced this issue Mar 18, 2022
@o2sh
Copy link
Owner

o2sh commented Mar 18, 2022

The request has been approved. Onefetch's snap (edge channel) has been granted read access to:

  • /etc/gitconfig
  • $HOME/.gitconfig
  • $HOME/.config/git/config

@Czaki
Copy link
Author

Czaki commented Mar 21, 2022

Just installed the version from edge and it works :)

Tested also non-edge and it still fails (so no other workaround happens and this solution is good).

@o2sh
Copy link
Owner

o2sh commented Apr 2, 2022

Since the v.2.12.0 release, this should also work on the stable channel.

@o2sh o2sh closed this as completed Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants