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

[BUG] Running FastFetch as a child process causes a mini fork bomb #1144

Closed
LivacoNew opened this issue Aug 2, 2024 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@LivacoNew
Copy link

LivacoNew commented Aug 2, 2024

Be sure to read the FAQ before submitting a new issue.

General description of bug:

  • What happened: Running FastFetch in a Rust program as a child process causes a infinite loop of FastFetch and the parent program opening each other. If you print the output of FastFetch from the process, it reports the parent process as the "shell". Because of this I think this is your version detection trying to run program --version and thus reinvoking FastFetch, which invokes the program etc.
    I'm aware of the dumb use-case argument here, however I do think this should be fixed regardless as there are programs that may wish to use FastFetch as a child process, for a currently working example hyfetch has you as a backend
  • What should happen: FastFetch should notice this happening and prevent a infinite loop. Shell detection should be corrected too, but that's the lesser issue.
  • Fastfetch version used: fastfetch 2.20.0 (x86_64)
  • Did it work in an older version: No
  • Where did you get the binary: Arch Package
  • Does this issue still occur in the latest dev build? Yes

Often helpful information:

Screenshot:
image
image

Rust script used:

use std::process::Command;

fn main() {
    let mut cmd: Command = Command::new("fastfetch");
    let output: String = String::from_utf8(cmd.output().expect("Failed to run").stdout).expect("Unable to parse output from raw UTF8");
    println!("{}", output);
}

The content of the configuration file you use (if any):

{
  "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
  "logo": {
    "color": {
      "1": "35",
      "2": "35"
    }
  },
  "display": {
    "color": "35",
    "separator": " > "
  },
  "general": {
    "detectVersion": true
  },
  "modules": [
    "title",
    "separator",

    "cpu",
    "gpu",
    "memory",
    "swap",
    "disk",
    "host",
    "display",

    "os",
    "kernel",
    "packages",
    "wm",
    "terminal",
    "shell",
    "editor",
    "uptime",
    "locale",
    "media",
    "initsystem",
    "processes",

    "break",
    "colors"
  ]
}

Output of fastfetch -c ci.jsonc --format json:

Redacted tons of private/personal information from this. Was ran from the same Rust script with the added arguments to let the false shell detection show here.

Very Long Output
[
  {
    "type": "Title",
    "result": {
      "userName": "sam",
      "hostName": "silverhand",
      "homeDir": "/home/sam/",
      "exePath": "/usr/bin/fastfetch",
      "userShell": "/bin/zsh"
    },
    "stat": 0
  },
  {
    "type": "Separator",
    "error": "Unsupported for JSON format",
    "stat": 0
  },
  {
    "type": "OS",
    "result": {
      "buildID": "rolling",
      "codename": "",
      "id": "arch",
      "idLike": "",
      "name": "Arch Linux",
      "prettyName": "Arch Linux",
      "variant": "",
      "variantID": "",
      "version": "",
      "versionID": ""
    },
    "stat": 0
  },
  {
    "type": "Host",
    "result": {
      "family": "B650 MB",
      "name": "B650 GAMING X AX",
      "version": "",
      "sku": "",
      "vendor": "Gigabyte Technology Co., Ltd.",
      "serial": "",
      "uuid": ""
    },
    "stat": 0
  },
  {
    "type": "Bios",
    "result": {
      "date": "03/11/2024",
      "release": "5.32",
      "vendor": "American Megatrends International, LLC.",
      "version": "FA3",
      "type": "UEFI"
    },
    "stat": 0
  },
  {
    "type": "Bootmgr",
    "result": {
      "name": "GRUB",
      "firmware": "\\EFI\\GRUB\\grubx64.efi",
      "secureBoot": false
    },
    "stat": 0
  },
  {
    "type": "Board",
    "result": {
      "name": "B650 GAMING X AX",
      "vendor": "Gigabyte Technology Co., Ltd.",
      "version": "x.x",
      "serial": ""
    },
    "stat": 0
  },
  {
    "type": "Chassis",
    "result": {
      "type": "Desktop",
      "vendor": "",
      "version": "",
      "serial": ""
    },
    "stat": 0
  },
  {
    "type": "Kernel",
    "result": {
      "architecture": "x86_64",
      "name": "Linux",
      "release": "6.10.2-arch1-1",
      "version": "#1 SMP PREEMPT_DYNAMIC Sat, 27 Jul 2024 16:49:55 +0000",
      "displayVersion": "",
      "pageSize": 4096
    },
    "stat": 0
  },
  {
    "type": "InitSystem",
    "result": {
      "name": "systemd",
      "exe": "/usr/lib/systemd/systemd",
      "version": "256.4-1-arch",
      "pid": 1
    },
    "stat": 3
  },
  {
    "type": "Uptime",
    "result": {
      "uptime": 9041890,
      "bootTime": "2024-08-03T00:36:42.474+0100"
    },
    "stat": 0
  },
  {
    "type": "Loadavg",
    "result": [
      1.93603515625,
      2.4013671875,
      2.29248046875
    ],
    "stat": 0
  },
  {
    "type": "Processes",
    "result": 368,
    "stat": 1
  },
  {
    "type": "Packages",
    "result": {
      "all": 1849,
      "apk": 0,
      "brew": 0,
      "brewCask": 0,
      "choco": 0,
      "dpkg": 0,
      "emerge": 0,
      "eopkg": 0,
      "flatpakSystem": 0,
      "flatpakUser": 0,
      "nixDefault": 0,
      "nixSystem": 0,
      "nixUser": 0,
      "pacman": 1849,
      "paludis": 0,
      "pkg": 0,
      "pkgtool": 0,
      "macports": 0,
      "rpm": 0,
      "scoop": 0,
      "snap": 0,
      "winget": 0,
      "xbps": 0,
      "opkg": 0,
      "am": 0,
      "sorcery": 0,
      "guixSystem": 0,
      "guixUser": 0,
      "guixHome": 0,
      "pacmanBranch": ""
    },
    "stat": 0
  },
  {
    "type": "Shell",
    "result": {
      "exe": "target/release/forking-issue",
      "exeName": "forking-issue",
      "exePath": "/home/sam/Repositories/Rust/forking-issue/target/release/forking-issue",
      "pid": 552469,
      "ppid": 1204765,
      "processName": "forking-issue",
      "prettyName": "forking-issue",
      "version": "",
      "tty": 2
    },
    "stat": 1001
  },
  {
    "type": "Editor",
    "result": {
      "type": "Visual",
      "name": "nvim",
      "path": "/usr/bin/nvim",
      "exe": "nvim",
      "version": "0.10.1"
    },
    "stat": 3
  },
  {
    "type": "Display",
    "result": [
      {
        "id": 3543560144569582664,
        "name": "24CV1Y",
        "primary": false,
        "output": {
          "width": 1080,
          "height": 1920
        },
        "scaled": {
          "width": 1080,
          "height": 1920
        },
        "physical": {
          "width": 320,
          "height": 520
        },
        "refreshRate": 74.986,
        "rotation": 270,
        "bitDepth": 0,
        "hdrEnabled": false,
        "wcgEnabled": false,
        "type": "External"
      },
      {
        "id": 841830468,
        "name": "27G2G8",
        "primary": false,
        "output": {
          "width": 1920,
          "height": 1080
        },
        "scaled": {
          "width": 1920,
          "height": 1080
        },
        "physical": {
          "width": 600,
          "height": 340
        },
        "refreshRate": 239.964,
        "rotation": 0,
        "bitDepth": 0,
        "hdrEnabled": false,
        "wcgEnabled": false,
        "type": "External"
      }
    ],
    "stat": 3
  },
  {
    "type": "Brightness",
    "result": [],
    "stat": 0
  },
  {
    "type": "Monitor",
    "result": [
      {
        "hdrCompatible": false,
        "name": "DP-2",
        "resolution": {
          "width": 1920,
          "height": 1080
        },
        "physical": {
          "height": 340,
          "width": 600
        },
        "refreshRate": 239.88085078136854,
        "manufactureDate": null,
        "serial": null
      },
      {
        "hdrCompatible": false,
        "name": "HDMI-A-1",
        "resolution": {
          "width": 1920,
          "height": 1080
        },
        "physical": {
          "height": 320,
          "width": 520
        },
        "refreshRate": 74.90566806015528,
        "manufactureDate": null,
        "serial": null
      }
    ],
    "stat": 1
  },
  {
    "type": "LM",
    "result": {
      "service": "sddm",
      "type": "Wayland",
      "version": "0.21.0"
    },
    "stat": 0
  },
  {
    "type": "DE",
    "error": "No DE found",
    "stat": 0
  },
  {
    "type": "WM",
    "result": {
      "processName": "Hyprland",
      "prettyName": "Hyprland",
      "protocolName": "Wayland",
      "pluginName": ""
    },
    "stat": 0
  },
  {
    "type": "WMTheme",
    "error": "Unknown WM: Hyprland",
    "stat": 0
  },
  {
    "type": "Theme",
    "result": {
      "theme1": "",
      "theme2": "Adwaita-dark [GTK3]"
    },
    "stat": 0
  },
  {
    "type": "Icons",
    "result": {
      "icons1": "",
      "icons2": "Adwaita-dark [GTK3]"
    },
    "stat": 0
  },
  {
    "type": "Font",
    "error": "No fonts found",
    "stat": 0
  },
  {
    "type": "Cursor",
    "result": {
      "theme": "BreezeX-RosePine-Linux",
      "size": "24"
    },
    "stat": 0
  },
  {
    "type": "Wallpaper",
    "error": "Failed to detect the current wallpaper path",
    "stat": 0
  },
  {
    "type": "Terminal",
    "result": {
      "processName": "kitty",
      "exe": "kitty",
      "exeName": "kitty",
      "exePath": "/usr/bin/kitty",
      "pid": 1204435,
      "ppid": 1,
      "prettyName": "kitty",
      "version": "0.35.2",
      "tty": ""
    },
    "stat": 1
  },
  {
    "type": "TerminalFont",
    "result": {
      "font": {
        "name": "JetBrainsMonoNLNFM-Light",
        "size": "9",
        "styles": [],
        "pretty": "JetBrainsMonoNLNFM-Light (9pt)"
      },
      "fallback": {
        "name": "",
        "size": "",
        "styles": [],
        "pretty": ""
      }
    },
    "stat": 0
  },
  {
    "type": "TerminalSize",
    "result": {
      "columns": 268,
      "rows": 62,
      "width": 1876,
      "height": 992
    },
    "stat": 0
  },
  {
    "type": "TerminalTheme",
    "result": {
      "fg": {
        "r": 255,
        "g": 255,
        "b": 255,
        "dark": false
      },
      "bg": {
        "r": 22,
        "g": 22,
        "b": 22,
        "dark": true
      }
    },
    "stat": 0
  },
  {
    "type": "CPU",
    "result": {
      "cpu": "AMD Ryzen 7 7800X3D",
      "vendor": "AuthenticAMD",
      "cores": {
        "physical": 8,
        "logical": 16,
        "online": 16
      },
      "frequency": {
        "base": 4722,
        "max": 5050,
        "biosLimit": 0
      },
      "coreTypes": [
        {
          "count": 16,
          "freq": 5050
        }
      ],
      "temperature": 54.5
    },
    "stat": 7
  },
  {
    "type": "CPUCache",
    "result": {
      "l1": [
        {
          "size": 32768,
          "num": 8,
          "lineSize": 64,
          "type": "data"
        },
        {
          "size": 32768,
          "num": 8,
          "lineSize": 64,
          "type": "instruction"
        }
      ],
      "l2": [
        {
          "size": 1048576,
          "num": 8,
          "lineSize": 64,
          "type": "unified"
        }
      ],
      "l3": [
        {
          "size": 100663296,
          "num": 1,
          "lineSize": 64,
          "type": "unified"
        }
      ]
    },
    "stat": 2
  },
  {
    "type": "CPUUsage",
    "result": [
      21.052631578947366,
      10.0,
      23.809523809523807,
      20.0,
      27.77777777777778,
      15.789473684210526,
      15.0,
      20.0,
      10.0,
      33.33333333333333,
      5.88235294117647,
      35.0,
      34.78260869565217,
      26.31578947368421,
      15.0,
      23.809523809523807
    ],
    "stat": 200
  },
  {
    "type": "GPU",
    "result": [
      {
        "coreCount": null,
        "memory": {
          "dedicated": {
            "total": null,
            "used": 1582182400
          },
          "shared": {
            "total": null,
            "used": null
          }
        },
        "driver": "amdgpu",
        "name": "AMD Radeon RX 7800 XT",
        "temperature": 52.0,
        "type": "Discrete",
        "vendor": "AMD",
        "platformApi": "DRM (card1)",
        "frequency": 0.0,
        "deviceId": 119288
      }
    ],
    "stat": 0
  },
  {
    "type": "Memory",
    "result": {
      "total": 32748625920,
      "used": 8498855936
    },
    "stat": 1
  },
  {
    "type": "PhysicalMemory",
    "error": "Failed to get SMBIOS data",
    "stat": 0
  },
  {
    "type": "Swap",
    "result": {
      "total": 8000327680,
      "used": 0
    },
    "stat": 0
  },
  {
    "type": "Disk",
    "result": [
      {
        "bytes": {
          "available": 70126174208,
          "free": 97296818176,
          "total": 533405655040,
          "used": 436108836864
        },
        "files": {
          "total": 33153024,
          "used": 1532056
        },
        "filesystem": "ext4",
        "mountpoint": "/",
        "mountFrom": "/dev/nvme0n1p5",
        "name": "",
        "volumeType": [
          "Regular"
        ],
        "createTime": "2023-12-11T19:45:41.000+0000"
      },
      {
        "bytes": {
          "available": 1179156480,
          "free": 1179156480,
          "total": 1341628416,
          "used": 162471936
        },
        "files": {
          "total": null,
          "used": null
        },
        "filesystem": "vfat",
        "mountpoint": "/boot",
        "mountFrom": "/dev/nvme0n1p1",
        "name": "EFI system partition",
        "volumeType": [
          "Hidden"
        ],
        "createTime": null
      },
      {
        "bytes": {
          "available": 76332834816,
          "free": 127159304192,
          "total": 999098699776,
          "used": 871939395584
        },
        "files": {
          "total": 62029824,
          "used": 170219
        },
        "filesystem": "ext4",
        "mountpoint": "/hdd",
        "mountFrom": "/dev/sdb3",
        "name": "",
        "volumeType": [
          "Regular"
        ],
        "createTime": "2024-01-29T21:08:38.000+0000"
      }
    ],
    "stat": 0
  },
  {
    "type": "Battery",
    "result": [],
    "stat": 0
  },
  {
    "type": "PowerAdapter",
    "result": [],
    "stat": 0
  },
  {
    "type": "Player",
    "result": {
      "player": "Spotify",
      "playerId": "spotify",
      "url": "https://open.spotify.com/track/24FFOpCA6bc5YoU2F3TKqS"
    },
    "stat": 0
  },
  {
    "type": "Media",
    "result": {
      "song": "Just For A Moment (feat. Iselin)",
      "artist": "Gryffin",
      "album": "Gravity",
      "status": ""
    },
    "stat": 0
  },
  {
    "type": "PublicIp",
    "result": {
      "ip": "{REMOVED}",
      "location": "{REMOVED}"
    },
    "stat": 0
  },
  {
    "type": "LocalIp",
    "result": [
      {
        "defaultRoute": true,
        "ipv4": "{REMOVED}",
        "ipv6": "{REMOVED}",
        "mac": "{REMOVED}",
        "name": "wlan0",
        "mtu": 1500
      }
    ],
    "stat": 1
  },
  {
    "type": "DNS",
    "result": [
      "{REMOVED}"
    ],
    "stat": 0
  },
  {
    "type": "Wifi",
    "result": [
      {
        "inf": {
          "description": "wlan0",
          "status": "Activated"
        },
        "conn": {
          "status": "Connected",
          "ssid": "{REMOVED}",
          "bssid": "{REMOVED}",
          "protocol": "{REMOVED}",
          "security": "{REMOVED}",
          "signalQuality": 42.0,
          "rxRate": 866.7,
          "txRate": 802.11
        }
      }
    ],
    "stat": 6
  },
  {
    "type": "DateTime",
    "result": "2024-08-02T22:06:01.811+0100",
    "stat": 0
  },
  {
    "type": "Locale",
    "result": "en_GB.UTF-8",
    "stat": 0
  },
  {
    "type": "Vulkan",
    "result": {
      "apiVersion": "1.3.278",
      "conformanceVersion": "1.3",
      "driver": "radv [Mesa 24.1.4-arch1.2]",
      "gpus": [
        {
          "type": "Discrete",
          "vendor": "AMD",
          "name": "AMD Radeon RX 7800 XT (RADV NAVI32)",
          "driver": "Mesa 24.1.4-arch1.2",
          "platformApi": "Vulkan 1.3.278",
          "deviceId": 29822,
          "memory": {
            "dedicated": {
              "total": 17163091968,
              "used": null
            },
            "shared": {
              "total": 16374312960,
              "used": null
            }
          },
          "deviceId": 29822
        }
      ]
    },
    "stat": 13
  },
  {
    "type": "OpenGL",
    "result": {
      "version": "4.6 (Compatibility Profile) Mesa 24.1.4-arch1.2",
      "renderer": "AMD Radeon RX 7800 XT (radeonsi, navi32, LLVM 18.1.8, DRM 3.57, 6.10.2-arch1-1)",
      "vendor": "AMD",
      "slv": "4.60",
      "library": "EGL 1.5"
    },
    "stat": 59
  },
  {
    "type": "OpenCL",
    "result": {
      "version": "1.1 Mesa 24.1.4-arch1.2",
      "name": "Clover",
      "vendor": "Mesa",
      "gpus": [
        {
          "type": "Discrete",
          "vendor": "AMD",
          "name": "gfx1101",
          "driver": "(HSA1.1,LC)",
          "platformApi": "OpenCL 2.0",
          "coreCount": 30,
          "frequency": 2254.0,
          "memory": {
            "dedicated": {
              "total": 17163091968,
              "used": null
            },
            "shared": {
              "total": null,
              "used": null
            }
          },
          "deviceId": 100328401264208
        },
        {
          "type": "Discrete",
          "vendor": "AMD",
          "name": "AMD Radeon RX 7800 XT (radeonsi, navi32, LLVM 18.1.8, DRM 3.57, 6.10.2-arch1-1)",
          "driver": "24.1.4-arch1.2",
          "platformApi": "OpenCL 1.1 Mesa 24.1.4-arch1.2",
          "coreCount": 60,
          "frequency": 2254.0,
          "memory": {
            "dedicated": {
              "total": 17179869184,
              "used": null
            },
            "shared": {
              "total": null,
              "used": null
            }
          },
          "deviceId": 100328397833080
        }
      ]
    },
    "stat": 73
  },
  {
    "type": "Users",
    "result": [
      {
        "name": "sam",
        "hostName": "",
        "sessionName": "tty1",
        "clientIp": "0.0.0.0",
        "loginTime": "2024-08-02T19:35:54.325+0100"
      }
    ],
    "stat": 0
  },
  {
    "type": "Bluetooth",
    "error": "Failed to call GetManagedObjects",
    "stat": 2
  },
  {
    "type": "Sound",
    "result": [
      {
        "active": true,
        "main": false,
        "volume": 100,
        "name": "Navi 31 HDMI/DP Audio Digital Stereo (HDMI)",
        "identifier": "alsa_output.pci-0000_03_00.1.hdmi-stereo"
      },
      {
        "active": true,
        "main": false,
        "volume": 94,
        "name": "Scarlett Solo 4th Gen Analog Stereo",
        "identifier": "alsa_output.usb-Focusrite_Scarlett_Solo_4th_Gen_S1G3E5H3301337-00.analog-stereo"
      },
      {
        "active": true,
        "main": false,
        "volume": 99,
        "name": "SteelSeries Arctis 1 Wireless Analog Stereo",
        "identifier": "alsa_output.usb-SteelSeries_SteelSeries_Arctis_1_Wireless-00.analog-stereo"
      },
      {
        "active": false,
        "main": true,
        "volume": 99,
        "name": "SteelSeries Arctis 1 Wireless Analog Stereo (echo cancelled with Scarlett Solo 4th Gen Multichannel)",
        "identifier": "echoCancel_sink"
      }
    ],
    "stat": 4
  },
  {
    "type": "Camera",
    "result": [
      {
        "name": "HD Webcam C615",
        "vendor": "",
        "colorSpace": "sRGB",
        "id": "usb-0000:12:00.4-2",
        "width": 640,
        "height": 480
      }
    ],
    "stat": 0
  },
  {
    "type": "Gamepad",
    "result": [
      {
        "serial": "",
        "name": "keyd virtual pointer"
      }
    ],
    "stat": 1
  },
  {
    "type": "Weather",
    "result": "{REMOVED}",
    "stat": 0
  },
  {
    "type": "NetIO",
    "result": [
      {
        "name": "wlan0",
        "defaultRoute": true,
        "txBytes": 76843,
        "rxBytes": 107456,
        "txPackets": 771,
        "rxPackets": 622,
        "rxErrors": 0,
        "txErrors": 0,
        "rxDrops": 0,
        "txDrops": 0
      }
    ],
    "stat": 0
  },
  {
    "type": "DiskIO",
    "result": [
      {
        "name": "WDC WDS100T2B0C",
        "devPath": "/dev/nvme0n1",
        "bytesRead": 0,
        "bytesWritten": 0,
        "readCount": 0,
        "writeCount": 0
      },
      {
        "name": "ATA ST2000DM008-2UB1",
        "devPath": "/dev/sdb",
        "bytesRead": 0,
        "bytesWritten": 0,
        "readCount": 0,
        "writeCount": 0
      },
      {
        "name": "ATA ST2000VM003-1CT1",
        "devPath": "/dev/sda",
        "bytesRead": 0,
        "bytesWritten": 0,
        "readCount": 0,
        "writeCount": 0
      }
    ],
    "stat": 0
  },
  {
    "type": "PhysicalDisk",
    "result": [
      {
        "name": "WDC WDS100T2B0C",
        "devPath": "/dev/nvme0n1",
        "interconnect": "NVMe",
        "kind": "SSD",
        "size": 1000204886016,
        "serial": "21335E458013",
        "removable": false,
        "readOnly": false,
        "revision": "211210WD",
        "temperature": 37.85
      },
      {
        "name": "ATA ST2000DM008-2UB1",
        "devPath": "/dev/sdb",
        "interconnect": "ATA",
        "kind": "HDD",
        "size": 2000398934016,
        "serial": "",
        "removable": false,
        "readOnly": false,
        "revision": "0001",
        "temperature": null
      },
      {
        "name": "ATA ST2000VM003-1CT1",
        "devPath": "/dev/sda",
        "interconnect": "ATA",
        "kind": "HDD",
        "size": 2000398934016,
        "serial": "",
        "removable": false,
        "readOnly": false,
        "revision": "SC23",
        "temperature": null
      }
    ],
    "stat": 0
  },
  {
    "type": "Version",
    "result": {
      "projectName": "fastfetch",
      "sysName": "Linux",
      "architecture": "x86_64",
      "version": "2.20.0",
      "versionTweak": "",
      "cmakeBuiltType": "RelWithDebInfo",
      "compileTime": "Jul 26 2024, 06:50:11",
      "compiler": "gcc 14.1.1",
      "debugMode": false,
      "libc": "glibc 2.40"
    },
    "stat": 0
  },
  {
    "type": "Break",
    "error": "Unsupported for JSON format",
    "stat": 0
  },
  {
    "type": "Colors",
    "error": "Unsupported for JSON format",
    "stat": 0
  }
]

Output of fastfetch --list-features:

threads
vulkan
wayland
xcb-randr
xcb
xrandr
x11
drm
gio
dconf
dbus
imagemagick7
chafa
zlib
xfconf
egl
glx
osmesa
opencl
libpulse
libnm
libddcutil
Directx Headers
System yyjson
linux/videodev2
linux/wireless
@LivacoNew LivacoNew added the bug Something isn't working label Aug 2, 2024
CarterLi added a commit that referenced this issue Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant