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

Constellations cannot be printed #10

Closed
auroraanna opened this issue Apr 16, 2022 · 10 comments
Closed

Constellations cannot be printed #10

auroraanna opened this issue Apr 16, 2022 · 10 comments
Labels
bug Something isn't working solved Issue solved

Comments

@auroraanna
Copy link

I installed with sudo make install
However I get

➜ /usr/local/bin/starfetch        
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::replace: __pos (which is 18446744073709551615) > this->size() (which is 723)
zsh: IOT instruction (core dumped)  /usr/local/bin/starfetch

or

✗ /usr/local/bin/starfetch -n orion
Error: the constellation you asked for isn't recognized.

starfetch is a command line tool that displays information about a constellation alongside its scheme.

Usage: starfetch [OPTION] [CONSTELLATION NAME]
    -h      Prints this help message.
    -n      Shows the selected constellation.
    -r      Shows a random constellation.
    -l      Prints the list of all the available constellations.
    
If launched with no arguments, the behaviour is the same as with '-r'.

Examples:   starfetch -r
            starfetch -n orion
            starfetch
@Haruno19
Copy link
Owner

That's weird.
Could you please post the output of ls /usr/local/starfetch/res/constellations/?

@Haruno19 Haruno19 added bug Something isn't working work in progress Currently working on this labels Apr 16, 2022
@auroraanna
Copy link
Author

➜ ls /usr/local/starfetch/res/constellations/
antlia.json    aries.json      cassiopeia.json	    gemini.json  ophiuchus.json    scorpio.json     virgo.json
apus.json      bootes.json     corona_borealis.json  leo.json	 orion.json	   taurus.json
aquarius.json  cancer.json     crux.json	    libra.json   pisces.json	   ursa_major.json
ara.json       capricorn.json  cygnus.json	    lupus.json   sagittarius.json  ursa_minor.json

@Haruno19
Copy link
Owner

I'm not able to replicate this bug; I tried on both MacOS and (Arch) Linux, and it worked as expected.
Therefore, if possible, I need to investigate on this issue directly on your environment.

It looks like either the path or pathc variables do not assume the expected value, resulting in starfetch not finding the .json files path. In order to verify this, could you please replace src/starfetch.cpp with this version (or just add a print statement like cout << pathc << endl; somewhere around line 60 of src/starfetch.cpp), re-install it and run again /usr/bin/starfetch -n orion please?

Thank you for your cooperation.

@Haruno19
Copy link
Owner

Haruno19 commented Apr 16, 2022

Upon further examination, considering the output of /usr/local/bin/starfetch it looks like string::begin on string s is returning a very high value (18446744073709551615), which, I suspect, means that s is empty.
The only thing that will lead to this outcome is the file f with path /usr/local/starfetch/res/template not being opened properly (which still is wired, because the basic_string::replace function is called only if f gets opened correctly).

Knowing what the path or pathc variables contain during execution will probably help solving this mystery.

@auroraanna
Copy link
Author

auroraanna commented Apr 16, 2022

I'm not able to replicate this bug; I tried on both MacOS and (Arch) Linux, and it worked as expected. Therefore, if possible, I need to investigate on this issue directly on your environment.

It looks like either the path or pathc variables do not assume the expected value, resulting in starfetch not finding the .json files path. In order to verify this, could you please replace src/starfetch.cpp with this version (or just add a print statement like cout << pathc << endl; somewhere around line 60 of src/starfetch.cpp), re-install it and run again /usr/bin/starfetch -n orion please?

Thank you for your cooperation.

➜ /usr/local/bin/starfetch -n orion
Error: the constellation you asked for isn't recognized.

starfetch is a command line tool that displays information about a constellation alongside its scheme.

Usage: starfetch [OPTION] [CONSTELLATION NAME]
    -h      Prints this help message.
    -n      Shows the selected constellation.
    -r      Shows a random constellation.
    -l      Prints the list of all the available constellations.
    
If launched with no arguments, the behaviour is the same as with '-r'.

Examples:   starfetch -r
            starfetch -n orion
            starfetch

still the same

@auroraanna
Copy link
Author

I guess this has to do with NixOS?

@auroraanna
Copy link
Author

auroraanna commented Apr 16, 2022

There is no /usr/local/starfetch/res/template on my machine. There is also nothing about that folder in the Makefile.

@Haruno19
Copy link
Owner

Haruno19 commented Apr 16, 2022

Uh? There's no template file under the res folder?
That's definitely what's causing this problem.

The makefile does this: cp -rf ./res ${INSTALL_DIR}/starfetch/, which copies the whole res folder into /usr/local/starfetch/, and the template file is inside that.

Can you please check if starfetch/res/template is present when you extract starfetch.tar.gz? It definitely is contained in the archive.

image

@Haruno19
Copy link
Owner

I don't know if it has to do with the fact that the template file has no extension, but I find it really weird?
If that's the case, I can fix this easily by giving it an extension and change the code accordingly, but it shouldn't be needed.

@auroraanna
Copy link
Author

auroraanna commented Apr 16, 2022

Umm… so originally I did git pull to update and got this issue. I now deleted the repo folder and cloned it again - issue solved 🤦

I have no idea why though and I don't care either.

@Haruno19 Haruno19 added solved Issue solved and removed work in progress Currently working on this labels Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solved Issue solved
Projects
None yet
Development

No branches or pull requests

2 participants