Git Product home page Git Product logo

Comments (31)

CarterLi avatar CarterLi commented on August 24, 2024

If you build fastfetch from source, can you get the stack trace? You should build fastfetch with -DCMAKE_BUILD_TYPE=Debug

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

If you build fastfetch from source, can you get the stack trace? You should build fastfetch with -DCMAKE_BUILD_TYPE=Debug

i managed to get the stack trace.

0x0000555555586ae9 in parseModuleJsonObject (type=0x55555583134c "initsystem", jsonVal=0x0, jsonDoc=0x0) at /home/user/fastfetch/src/common/jsonconfig.c:104
104	   for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(type[0]) - 'A']; *modules; ++modules)
#0  0x0000555555586ae9 in parseModuleJsonObject (type=0x55555583134c "initsystem", jsonVal=0x0, jsonDoc=0x0) at /home/user/fastfetch/src/common/jsonconfig.c:104
        modules = 0x0 :ssssssso.    
#1  0x0000555555587849 in printJsonConfig (prepare=false, jsonDoc=0x0) at /home/user/fastfetch/src/common/jsonconfig.c:201
        ms = 0/        +ssssooo/-    
        module = 0x0   -:/+osssso+-    
        type = 0x55555583134c "initsystem"
        root = 0x555555835c70   `-/+/    
        __PRETTY_FUNCTION__ = "printJsonConfig"
        modules = 0x555555835d10
        item = 0x555555835db0
        idx = 9
        max = 64
#2  0x0000555555587eb8 in ffPrintJsonConfig (prepare=false, jsonDoc=0x0) at /home/user/fastfetch/src/common/jsonconfig.c:233
        error = 0x55555582abc0 <instance> ""
#3  0x000055555557c251 in run (data=0x7fffffffe300) at /home/user/fastfetch/src/fastfetch.c:710
        useJsonConfig = true
#4  0x000055555557cb5b in main (argc=3, argv=0x7fffffffe448) at /home/user/fastfetch/src/fastfetch.c:773
        data = {structure = {allocated = 0, length = 0, chars = 0x5555557ea468 ""}, configLoaded = true}

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(type[0]) - 'A']; *modules; ++modules)

Strangely, the stack trace points to a common function that should not crash. The core dump file you uploaded contains 11 stack frames but the stack trace pasted below contains 5.

Core was generated by `/home/user/fastfetch/build/fastfetch'.
Program terminated with signal SIGINT, Interrupt.
#0  0x00007ffff7d98337 in ?? ()
(gdb) bt
#0  0x00007ffff7d98337 in ?? ()
#1  0x00007ffff7d9dd52 in ?? ()
#2  0x00007fffffffbf20 in ?? ()
#3  0x9f401203fdeb0000 in ?? ()
#4  0x0000003000000020 in ?? ()
#5  0x00007fffffffbf30 in ?? ()
#6  0x00005555556e4a10 in ?? ()
#7  0x00007fffffffe00c in ?? ()
#8  0x00007fffffffbf3c in ?? ()
#9  0x00000000fffffffc in ?? ()
#10 0x0000000000000000 in ?? ()

Are you sure that fastfetch did crash before you generated the stack trace? Can you paste the full gdb output here?

What does cat /proc/1/comm print?

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

I Reinstalled Arch Linux, Still getting the same error.

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

Please follow this:

  1. build fastfetch in debug mode with -DCMAKE_BUILD_TYPE=Debug
  2. run it
  3. upload the core dump file when it crashes

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

Please follow this:

1. build fastfetch in debug mode with `-DCMAKE_BUILD_TYPE=Debug`

2. run it

3. upload the core dump file when it crashes

Here:
core.8138.tar.gz

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024
Core was generated by `/home/user/fastfetch/build/fastfetch --load-config all'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000555555586adb in ?? ()
[Current thread is 1 (LWP 8138)]
(gdb) bt
#0  0x0000555555586adb in ?? ()
#1  0x00007ffff7ffd000 in ?? ()
#2  0x0000000000000000 in ?? ()

A completely different stack trace, but still no symbols.

I guess the stack has been corrupted. Please try fastfetch -s initsystem --no-buffer. If it crashes, upload both the fastfetch binary you built and core dump file.

Thanks for your help

EDIT: please apply this patch before testing

diff --git a/src/detection/initsystem/initsystem_linux.c b/src/detection/initsystem/initsystem_linux.c
index 078d36f1..3e47c1c3 100644
--- a/src/detection/initsystem/initsystem_linux.c
+++ b/src/detection/initsystem/initsystem_linux.c
@@ -3,9 +3,12 @@

 const char* ffDetectInitSystem(FFInitSystemResult* result)
 {
+    puts("0");
     const char* error = ffProcessGetBasicInfoLinux((int) result->pid, &result->name, NULL, NULL);
     if (error) return error;

+    puts("1");
+
     const char* _;
     // In linux /proc/1/exe is not readable
     ffProcessGetInfoLinux((int) result->pid, &result->name, &result->exe, &_, NULL);
@@ -16,18 +19,22 @@ const char* ffDetectInitSystem(FFInitSystemResult* result)
         if (realpath(result->exe.chars, buf))
             ffStrbufSetS(&result->exe, buf);
     }
+    puts("2");

     if (ffStrbufEqualS(&result->name, "systemd"))
     {
+    puts("3");
         if (ffProcessAppendStdOut(&result->version, (char* const[]) {
             ffStrbufEndsWithS(&result->exe, "/systemd") ? result->exe.chars : "systemctl", // use exe path in case users have another systemd installed
             "--version",
             NULL,
         }) == NULL && result->version.length)
         {
+    puts("4");
             uint32_t iStart = ffStrbufFirstIndexC(&result->version, '(');
             if (iStart < result->version.length)
             {
+    puts("5");
                 uint32_t iEnd = ffStrbufNextIndexC(&result->version, iStart + 1, ')');
                 ffStrbufSubstrBefore(&result->version, iEnd);
                 ffStrbufSubstrAfter(&result->version, iStart);
@@ -52,6 +59,7 @@ const char* ffDetectInitSystem(FFInitSystemResult* result)
             }
         }
     }
+    puts("6");

     return NULL;
 }

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

fastfetch -s initsystem --no-buffer

Reading symbols from ./fastfetch...
Starting program: /home/user/fastfetch/build/fastfetch -s initsystem --no-buffer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00005555555815e5 in parseStructureCommand (line=0x55555582fd70 "initsystem", fn=0x555555580844 <genJsonResult>, jsonDoc=0x0) at /home/user/fastfetch/src/common/commandoption.c:88
88	       for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
#0  0x00005555555815e5 in parseStructureCommand (line=0x55555582fd70 "initsystem", fn=0x555555580844 <genJsonResult>, jsonDoc=0x0) at /home/user/fastfetch/src/common/commandoption.c:88
        modules = 0xffffffffffffffff
#1  0x00005555555816de in ffPrintCommandOption (data=0x7fffffffe3a0, jsonDoc=0x0) at /home/user/fastfetch/src/common/commandoption.c:118
        colonIndex = 10++:    
        ms = 0++++++++++++:    
        startIndex = 0ooooo/    
#2  0x000055555557c259 in run (data=0x7fffffffe3a0) at /home/user/fastfetch/src/fastfetch.c:712
        useJsonConfig = false+    
#3  0x000055555557cb4b in main (argc=4, argv=0x7fffffffe4e8) at /home/user/fastfetch/src/fastfetch.c:773
        data = {structure = {allocated = 32, length = 10, chars = 0x55555582fd70 "initsystem"}, configLoaded = false}

fastfetch.tar.gz

core.4173.tar.gz

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

What does fastfetch -s initsystem --no-buffer print without running in gdb?

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

resim
note: i have reinstalled arch and my hostname has changed.

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

Try fastfetch -s initsystem --no-buffer -l none instead

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

fastfetch -s initsystem --no-buffer -l none

resim

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024
diff --git a/src/common/commandoption.c b/src/common/commandoption.c
index 3d9c9374..8396b3fc 100644
--- a/src/common/commandoption.c
+++ b/src/common/commandoption.c
@@ -85,15 +85,19 @@ static void parseStructureCommand(
 {
     if(ffCharIsEnglishAlphabet(line[0]))
     {
+        fputs(line, stderr);
         for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
         {
+            fputs("p1", stderr);
             FFModuleBaseInfo* baseInfo = *modules;
             if (ffStrEqualsIgnCase(line, baseInfo->name))
             {
+            fputs("p2", stderr);
                 if (__builtin_expect(jsonDoc != NULL, false))
                     fn(baseInfo, jsonDoc);
                 else
                     baseInfo->printModule(baseInfo);
+            fputs("p3", stderr);
                 return;
             }
         }

Please apply this patch and try the command again, thanks.

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024
diff --git a/src/common/commandoption.c b/src/common/commandoption.c
index 3d9c9374..8396b3fc 100644
--- a/src/common/commandoption.c
+++ b/src/common/commandoption.c
@@ -85,15 +85,19 @@ static void parseStructureCommand(
 {
     if(ffCharIsEnglishAlphabet(line[0]))
     {
+        fputs(line, stderr);
         for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
         {
+            fputs("p1", stderr);
             FFModuleBaseInfo* baseInfo = *modules;
             if (ffStrEqualsIgnCase(line, baseInfo->name))
             {
+            fputs("p2", stderr);
                 if (__builtin_expect(jsonDoc != NULL, false))
                     fn(baseInfo, jsonDoc);
                 else
                     baseInfo->printModule(baseInfo);
+            fputs("p3", stderr);
                 return;
             }
         }

Please apply this patch and try the command again, thanks.

resim

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

So it did crashed at for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)

diff --git a/src/common/commandoption.c b/src/common/commandoption.c
index 3d9c9374..48ce80e4 100644
--- a/src/common/commandoption.c
+++ b/src/common/commandoption.c
@@ -85,15 +85,22 @@ static void parseStructureCommand(
 {
     if(ffCharIsEnglishAlphabet(line[0]))
     {
-        for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
+        fprintf(stderr, "%s: %c - %c = %d\n", line, toupper(line[0]), 'A', toupper(line[0]) - 'A');
+        FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A'];
+        fprintf(stderr, "modules: %p\n", modules);
+        fprintf(stderr, "*modules: %p\n", *modules);
+        for (; *modules; ++modules)
         {
+            fputs("p1\n", stderr);
             FFModuleBaseInfo* baseInfo = *modules;
             if (ffStrEqualsIgnCase(line, baseInfo->name))
             {
+            fputs("p2\n", stderr);
                 if (__builtin_expect(jsonDoc != NULL, false))
                     fn(baseInfo, jsonDoc);
                 else
                     baseInfo->printModule(baseInfo);
+            fputs("p3", stderr);
                 return;
             }
         }

Try this please

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

It was really strange. The binary you just uploaded works for me. Arch linux too.

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

So it did crashed at for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)

diff --git a/src/common/commandoption.c b/src/common/commandoption.c
index 3d9c9374..48ce80e4 100644
--- a/src/common/commandoption.c
+++ b/src/common/commandoption.c
@@ -85,15 +85,22 @@ static void parseStructureCommand(
 {
     if(ffCharIsEnglishAlphabet(line[0]))
     {
-        for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
+        fprintf(stderr, "%s: %c - %c = %d\n", line, toupper(line[0]), 'A', toupper(line[0]) - 'A');
+        FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A'];
+        fprintf(stderr, "modules: %p\n", modules);
+        fprintf(stderr, "*modules: %p\n", *modules);
+        for (; *modules; ++modules)
         {
+            fputs("p1\n", stderr);
             FFModuleBaseInfo* baseInfo = *modules;
             if (ffStrEqualsIgnCase(line, baseInfo->name))
             {
+            fputs("p2\n", stderr);
                 if (__builtin_expect(jsonDoc != NULL, false))
                     fn(baseInfo, jsonDoc);
                 else
                     baseInfo->printModule(baseInfo);
+            fputs("p3", stderr);
                 return;
             }
         }

Try this please

resim
i also have reversed the other patch because this one did not apply

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

i - A = 40

What locale are you using? Does your language have the upper case I?

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

i - A = 40

What locale are you using? Does your language have the upper case I?

Yes But Its For ı not i. i becomes İ

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

OMG

i - A = 40
What locale are you using? Does your language have the upper case I?

Yes But Its For ı not i. i becomes İ

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024
diff --git a/src/common/commandoption.c b/src/common/commandoption.c
index 3d9c9374..ecf6b839 100644
--- a/src/common/commandoption.c
+++ b/src/common/commandoption.c
@@ -77,6 +77,11 @@ static void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc)
         yyjson_mut_obj_add_str(doc, module, "error", "Unsupported for JSON format");
 }

+char toUpperNoLocale(char c)
+{
+    return c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c;
+}
+
 static void parseStructureCommand(
     const char* line,
     void (*fn)(FFModuleBaseInfo *baseInfo, yyjson_mut_doc* jsonDoc),
@@ -85,7 +90,7 @@ static void parseStructureCommand(
 {
     if(ffCharIsEnglishAlphabet(line[0]))
     {
-        for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
+        for (FFModuleBaseInfo** modules = ffModuleInfos[toUpperNoLocale(line[0]) - 'A']; *modules; ++modules)
         {
             FFModuleBaseInfo* baseInfo = *modules;
             if (ffStrEqualsIgnCase(line, baseInfo->name))

This should fix the issue

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024
diff --git a/src/common/commandoption.c b/src/common/commandoption.c
index 3d9c9374..ecf6b839 100644
--- a/src/common/commandoption.c
+++ b/src/common/commandoption.c
@@ -77,6 +77,11 @@ static void genJsonResult(FFModuleBaseInfo* baseInfo, yyjson_mut_doc* doc)
         yyjson_mut_obj_add_str(doc, module, "error", "Unsupported for JSON format");
 }

+char toUpperNoLocale(char c)
+{
+    return c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c;
+}
+
 static void parseStructureCommand(
     const char* line,
     void (*fn)(FFModuleBaseInfo *baseInfo, yyjson_mut_doc* jsonDoc),
@@ -85,7 +90,7 @@ static void parseStructureCommand(
 {
     if(ffCharIsEnglishAlphabet(line[0]))
     {
-        for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules)
+        for (FFModuleBaseInfo** modules = ffModuleInfos[toUpperNoLocale(line[0]) - 'A']; *modules; ++modules)
         {
             FFModuleBaseInfo* baseInfo = *modules;
             if (ffStrEqualsIgnCase(line, baseInfo->name))

This should fix the issue

now it outputs nothing
resim

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

Still better than crashing.

Try append flag --format json

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

Still better than crashing.

Try append flag --format json

outputs:[]
resim

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

Try LANG=C fastfetch ...

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

LANG=C

finally...
resim

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

will there be a patch?

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

I still dont know how the your locale works. Which locale on earth are you using?

from fastfetch.

unkn0wncvm1 avatar unkn0wncvm1 commented on August 24, 2024

I still dont know how the your locale works. Which locale on earth are you using?

tr_TR.UTF-8

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

I need more time for investigation. Thanks for your information

from fastfetch.

CarterLi avatar CarterLi commented on August 24, 2024

You can revert all the patches. LANG=C should work fine

from fastfetch.

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.