Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

FreeBSD: Terminating a program with F9 or k doesn’t work #764

Closed
isadon opened this issue Mar 18, 2018 · 4 comments
Closed

FreeBSD: Terminating a program with F9 or k doesn’t work #764

isadon opened this issue Mar 18, 2018 · 4 comments

Comments

@isadon
Copy link

isadon commented Mar 18, 2018

This occurs on 2.1.0 and the latest master commit: 5a75797
Attempting to kill or terminate a program via F9 or k on FreeBSD 11.1 doesn’t work.

htop responds with:

No such file or directory

Building from master on the commit above has no effect.
Reverting to 2.0.2 restores functionality.

@yurivict
Copy link

I can confirm.

@gzip4
Copy link

gzip4 commented Mar 20, 2018

FreeBSD 11, htop 2.1.0
file: SignalsPanel.c
line: xSnprintf(buf, 15, "%2d SIGRTMIN%-+3d", sig, n);
try to print "100 SIGRTMIN+35" to 15-byte buffer and there's no space to \0 byte, htop dies.
changing 15 to 16 solves this problem.

if (SIGRTMAX - SIGRTMIN <= 100) {
      static char buf[16];
      for (int sig = SIGRTMIN; sig <= SIGRTMAX; i++, sig++) {
         int n = sig - SIGRTMIN;
         xSnprintf(buf, 16, "%2d SIGRTMIN%-+3d", sig, n);

@gzip4
Copy link

gzip4 commented Mar 20, 2018

last items in signal's list (when press F9) on my system are:

123 SIGRTMIN+5
124 SIGRTMIN+5
125 SIGRTMIN+6
126 SIGRTMIN+6

@gzip4
Copy link

gzip4 commented Mar 23, 2018

if you don't need SIGRT* signals, you may use this patch...

/usr/ports/sysutils/htop/files/patch-SignalsPanel.c

--- SignalsPanel.c.orig>2018-03-23 07:30:26 UTC
+++ SignalsPanel.c
@@ -39,19 +39,6 @@ Panel* SignalsPanel_new() {
          defaultPosition = i;
       }
    }
-   #if (defined(SIGRTMIN) && defined(SIGRTMAX))
-   if (SIGRTMAX - SIGRTMIN <= 100) {
-      static char buf[15];
-      for (int sig = SIGRTMIN; sig <= SIGRTMAX; i++, sig++) {
-         int n = sig - SIGRTMIN;
-         xSnprintf(buf, 15, "%2d SIGRTMIN%-+3d", sig, n);
-         if (n == 0) {
-            buf[11] = '\0';
-         }
-         Panel_set(this, i, (Object*) ListItem_new(buf, sig));
-      }
-   }
-   #endif
    Panel_setHeader(this, "Send signal:");
    Panel_setSelected(this, defaultPosition);
    return this;

hishamhm added a commit that referenced this issue Apr 6, 2018
Thanks to @gzip4 for tracking this down.

Closes #764.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants