SoulDJ673 / pasfetch

A simple fetch program written in Pascal
2 stars 1 forks source link

NetBSD & General BSD Support #2

Open polluks opened 2 years ago

polluks commented 2 years ago

Free Pascal Compiler version 3.2.2 [2021/05/25] for x86_64


uAnsiCrt.pas(392,27) Error: Illegal expression
uAnsiCrt.pas(392,29) Error: Illegal expression
uAnsiCrt.pas(392,29) Fatal: Syntax error, ";" expected but "identifier INT2STR"
found
Fatal: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode
SoulDJ673 commented 2 years ago

@polluks I spun up a fresh NetBSD vm, and I was only able to replicate this error after installing the Linux version of FPC. Building pasfetch using the NetBSD version completes successfully, though is still quite useless. Pasfetch has yet to support any *BSD, and I'm not sure that it will any time soon. Pull requests are welcome, or if support is added upstream I'll merge it in. I'm quite busy but I suppose I could work on it, though that might take a while.

polluks commented 2 years ago

If I comment out INT2STR calls

$ ./pasfetch
An unhandled exception occurred at $0000000000428459:
EFOpenError: Unable to open file "/etc/os-release": No such file or directory
  $0000000000428459
  $00000000004281F3

your exception handling seems incomplete.

SoulDJ673 commented 2 years ago

The latest push should work, although still quite useless. I did also notice that it outputs a bogus uptime on NetBSD, and I'm sure it will on other BSDs too. Error handling is a bit messy, I'm not particularly familiar with Pascal. I do plan on cleaning it up later though.

polluks commented 2 years ago

$ gdb ./pasfetch
...
File handling error occurred. Details: File not open
Program received signal SIGILL, Illegal instruction.
0x00000000004242ce in GETUPTIME () at uPasfetchUtils.pas:146
146             aDatetime := (GetTickCount64 / SecsPerDay / MSecsPerSec);
...
$ cat /proc/version
NetBSD version 8.2 (netbsd@localhost) (gcc version 5.5.0) NetBSD 8.2 (GENERIC) #0: Tue Mar 31 05:08:40 UTC 2020
SoulDJ673 commented 2 years ago

I'm going to be rewriting most of the functions so they don't rely so much on Linux-only things. That line won't exist anymore, so maybe that'll fix it, idk. Stay tuned.

SoulDJ673 commented 2 years ago

I haven't pushed any changes here, but I have gotten a little bit done. Firstly, GetUptime() has been rewritten to parse /proc/uptime, and has been tested to work on NetBSD 9.0. I've been rewriting GetRamUsage() to be more flexible, as to fix issue #3. This will eventually support BSD, but my most recent push on my git server gives bad numbers due to differences in how memory is calculated. I put the clone url in #3 if you want to check out that code.

Upstream has had some updates, I do want to merge those in and try to push up some of my changes once I clean up the git history a bit.

polluks commented 2 years ago

Some progress... NetBSD