Bug 239832 (mate, secpanel, under) - security/secpanel hard-coding of "gnome-terminal" fails under mate-only installation
Summary: security/secpanel hard-coding of "gnome-terminal" fails under mate-only insta...
Status: Closed FIXED
Alias: mate, secpanel, under
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kurt Jaeger
Depends on:
Reported: 2019-08-13 21:18 UTC by Jim D.
Modified: 2019-08-29 10:23 UTC (History)
3 users (show)

See Also:

svn-diff-secpanel (1.18 KB, patch)
2019-08-19 03:59 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v2 (1.18 KB, patch)
2019-08-19 04:01 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v3 (1.18 KB, patch)
2019-08-19 04:08 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-nspr_v4 (2.31 KB, patch)
2019-08-20 13:35 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v5 (2.31 KB, patch)
2019-08-23 06:33 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v6 (2.31 KB, patch)
2019-08-23 11:41 UTC, Walter Schwarzenfeld
no flags Details | Diff
Modified "~/.secpanel/config" file with many more definitions than the default (597 bytes, text/plain)
2019-08-26 05:44 UTC, Jim D.
no flags Details
Builtin requirement for TCL/TK version (305 bytes, text/plain)
2019-08-26 06:03 UTC, Jim D.
no flags Details
Add one value to secpanel "initconfigs proc" to make secpanel initialization work (253 bytes, patch)
2019-08-26 06:51 UTC, Jim D.
no flags Details | Diff
svn-diff-secpanel_v7 (3.46 KB, patch)
2019-08-26 08:08 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v8 (4.11 KB, patch)
2019-08-26 09:37 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v9 (5.17 KB, patch)
2019-08-26 09:39 UTC, Walter Schwarzenfeld
no flags Details | Diff
Secpanel Configurations panel - were app default values may be changed (32.28 KB, image/png)
2019-08-26 21:05 UTC, Jim D.
no flags Details
svn-diff-secpanel_v10 (6.34 KB, patch)
2019-08-26 22:31 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v11 (6.38 KB, patch)
2019-08-26 22:48 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v12 (6.20 KB, patch)
2019-08-26 22:50 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v13 (6.51 KB, patch)
2019-08-27 07:24 UTC, Walter Schwarzenfeld
no flags Details | Diff
svn-diff-secpanel_v14 (6.51 KB, patch)
2019-08-28 13:29 UTC, Walter Schwarzenfeld
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim D. 2019-08-13 21:18:37 UTC
usr/local/lib/secpanel/termdefs.txt:set termtype(GNOME-Terminal_path) "gnome-terminal"


stage/usr/local/share/secpanel/termdefs.txt:set termtype(GNOME-Terminal_path) "gnome-terminal"

will fail in a mate-only installation where gnome-terminal is not installed (eg; no terminal window opens up and the requested action fails)

Possible solutions:
a) add make code to the Makefile to force a choice of "gnome-terminal", "mate-terminal", or soemthing else (eg; xterm ?)

b) mate system user creates a link between "mate-terminal" and "gnome-terminal" in the path above; this would imply a friendly suggestion in the port "pkg-descr" file

c) mate system user installs "gnome-terminal" and everything thing is "hunkey-dorey"; this probably won't cause any undesirable side affect of installing more of Gnome as all of the gnome-terminal requisites also can be found in the "mate" environment
Comment 1 Jim D. 2019-08-13 21:27:47 UTC
Hmm - spoke too soon about installing gnome-terminal not requiring more non-mate programs. Looking further down the gnome-terminal Makefile I now see:


and mention of nautilus.

Suggestions a) and b) offered earlier would seem to be better so as to not "contaminate" a mate-only installation with more "gnome" applications.
Comment 2 Jim D. 2019-08-17 15:33:59 UTC
Hmmm - can't find the reference to "stage/usr/local....." so just the usr/ports/security/secpanel/work/usr/local...." reference is relevant (as it is a subdirectory of "secpanel/work").

One could also apply a 'diff -c' patch to the installed "/usr/local/share/secpanel/termdefs.txt" file, but this is then a user function rather than a port Makefile option.
Comment 3 Walter Schwarzenfeld freebsd_triage 2019-08-17 15:53:38 UTC
(In reply to Jim D. from comment #1)
I don't really understand what happens. 
Does gnome-terminal not install or not start?

Post the exact error-message.
Comment 4 Jim D. 2019-08-18 22:35:31 UTC
It is not a problem of gnome-terminal failing to be installed.

The issue is that secpanel's default configuration specifically uses "gnome-terminal" as its runtime option. I do not have the Gnome desktop installed - I have the Mate desktop installed. Hence - "gnome-terminal" is not installed. This makes secpanel unusable as it attempts to invoke "gnome-terminal" which doesn't exist.

By changing the secpanel default terminal definition to "mate-terminal", I can now get the full secpanel functionality without the Gnome desktop.

The suggestions offered were to modify the Makefile to provide a port installer the option of which terminal application to define for secpanel to use.
Comment 5 Walter Schwarzenfeld freebsd_triage 2019-08-19 03:59:20 UTC
Created attachment 206687 [details]

You mean something like that?
Comment 6 Walter Schwarzenfeld freebsd_triage 2019-08-19 04:01:08 UTC
Created attachment 206688 [details]

Was a typo in.
Comment 7 Walter Schwarzenfeld freebsd_triage 2019-08-19 04:08:35 UTC
Created attachment 206689 [details]
Comment 8 Jim D. 2019-08-19 18:30:54 UTC
Yes - v3 looks good and provides for either/both gnome-terminal and mate-terminal. 

Will that also change the 'work/usr/local/lib/secpanel/termdefs.txt:set termtype(GNOME-Terminal_path) "gnome-terminal"' definition? For Mate it's just replacing "gnome-terminal" with "mate-terminal".

Of course, one could be more explicit and also replace "GNOME-Terminal_path" but that would probably force other changes. It is the later part that is important as it is the system command that gets executed.

I don't know if adding xterm would be useful or not.
Comment 9 Walter Schwarzenfeld freebsd_triage 2019-08-20 13:35:02 UTC
Created attachment 206726 [details]

You have to test by yourself. Secpanel does not start on my system.
Comment 10 Jim D. 2019-08-22 21:23:42 UTC
Patches are good.
Looking at results...
Am in the middle of massive local ports updates and numereous issues.
Will get back to you when able to.
Have found some things in the runtime script to look at.
Comment 11 Jim D. 2019-08-22 23:12:48 UTC
Now that I have TK and TCL reinstalled, there is one change needed in file patch (case change):

set termtype(Mate-Terminal_...).. => set termtype(MATE-Terminal_...) ..

Application works with patches and local modifications.

Still need to do more testing from application removal to application installation as there seems to be some differences in the "config" file that gets created versus what I had after making simple "Gnome" => "Mate" change in the  "<home>.secpanel/config" file. By default, the inital "config" file has only 2 lines whereas my "in-use config" file has 20 lines. 

FWIW - I also modified the 'set termtype(MATE...path) "mate-terminal"' to include a geometry paramater " --geometry=97x26". Don't know of an easy way to provide another Makefile option to select a "default terminal window size". May be able to specify a mate-terminal profile as defined by user (profile/General "Use custom default terminal size") using the mate-terminal "--profile=" parameter rather than raw geometry parameter.

P.S. I use this application A LOT and it is VERY HANDY. I only have 15 entries ("secpanel profiles") but it saves me a lot of work opening up multiple, concurent, SSH sessions which I use just about every day for my own PHP/Apache development).
Comment 12 Walter Schwarzenfeld freebsd_triage 2019-08-23 06:33:53 UTC
Created attachment 206813 [details]

Change set termtype math-terminal to MATE-terminal.
Comment 13 Walter Schwarzenfeld freebsd_triage 2019-08-23 11:41:47 UTC
Created attachment 206821 [details]

v5 was the wrong change.
Comment 14 Jim D. 2019-08-26 05:44:24 UTC
Created attachment 206912 [details]
Modified "~/.secpanel/config" file with many more definitions than the default

I don't remember how this modified user secpanel config file was created, but then - I have been using secpanel for quite a few years. Nevertheless, the necessary "browserbin" entry is there. The current version of Secpanel does not create this modified config file. It may be that an earlier version of the Secpanel application or an earlier version of a FBSD Secpanel port may have created it.

Note that the "termver" was changed manually by me where it was "GNOME-Terminal" before.
Comment 15 Jim D. 2019-08-26 05:57:36 UTC
There is still something "wrong" about the implementation of secpanel. Once installed, it uses a default user configuration file that has only two lines in it which do not define any terminal or browser application. When attempting to execute "secpanel" from icon - nothing appears to happen. When executing the "/usr/local/bin/secpanel" script manually, it fails:

Error in startup script: can't read "configs(browserbin)": no such element in array
    while executing
"$widget([set f]ent) insert 0 "$configs([set f]bin)""
    (procedure "main" line 11)
    invoked from within
"main $argc $argv"
    (file "/usr/local/bin/secpanel" line 2567)

The element being searched for does not exist within the application "default.config" file.

Yet, when I copy over my previous user "config" file (see attachment 206912 [details]), everything works just fine. So SOMEthing, SOMEwhere, created the modified user config file. I know that _I_ didn't create the entire thing on my own.

I have looked long at the Secpanel TCL scripts and can't find any resolution to this issue. I also don't understand one TCL "foreach" statement that has an odd number of values used to assign to two loop variables, manages to work.

Something within TCL/TK-land must have generated the user config file that I have, but I cannot see what or where.

It may be simplest just to supply two "sample" config files, without the "wins" statements, for the two major terminal emulators: gnome-terminal and mate-terminal. I will test some variations on this and report back.
Comment 16 Jim D. 2019-08-26 06:03:56 UTC
Created attachment 206913 [details]
Builtin requirement for TCL/TK version

The Makefile for Secpanel port might need another REQUIRES statement for TCL/TK version.
Comment 17 Jim D. 2019-08-26 06:51:20 UTC
Created attachment 206914 [details]
Add one value to secpanel "initconfigs proc" to make secpanel initialization work

Found out how to use the TCL "puts" command and "traced" the Secpanel "initconfigs" proc with just the default "config" file. Adding "thunar" following the "Thunar" value entry solves the problem of an unbalanced "value list". This the allows Secpanel to create a modified user "config" file that allows the application to work.
Comment 18 Jim D. 2019-08-26 06:54:17 UTC
Only major change left: get Makefle "do-install" block to (sed) modify the "secpanel" TCL script in its "initconfigs" proc to replace "Xterm" with the makefile selected terminal type (eg; "GNOME-Terminal" or "MATE-Terminal").
Comment 19 Walter Schwarzenfeld freebsd_triage 2019-08-26 08:08:28 UTC
Created attachment 206916 [details]
Comment 20 Walter Schwarzenfeld freebsd_triage 2019-08-26 08:08:56 UTC
(In reply to Jim D. from comment #16)
Comment 21 Walter Schwarzenfeld freebsd_triage 2019-08-26 09:37:05 UTC
Created attachment 206917 [details]

Added most of the desired changes to default.config. But renamed it to default.config.sample (maybe, we also need a pkg-message for that).
Comment 22 Walter Schwarzenfeld freebsd_triage 2019-08-26 09:39:39 UTC
Created attachment 206918 [details]

Forgot to svn add the patch-default.config.

In the meantime secpanel also starts on my system.
Comment 23 Walter Schwarzenfeld freebsd_triage 2019-08-26 10:19:11 UTC
Assignee was wrong, sorry.
Comment 24 Jim D. 2019-08-26 20:45:40 UTC
(In reply to Walter Schwarzenfeld from comment #20)

If the port Makefile doesn't specify minimum TCL/TK required for Secpanel and someone tries to run an installed Secpanel under TCL/TK < 8.0, they will get a warning message. That is OK as it would inform the user that they need to install a suitable version of TCL/TK. I just thought that if the TCL/TK minimum version check was in the Makefile, then a user will know up front (sooner, quicker?) that they will require a newer version of TCL/TK.

Not having a version check within the Makefile doesn't affect the port installation as there is no code assembly/compilation performed. Having the TCL/TK version check in the Makefile would then be "convenience" addition.
Comment 25 Jim D. 2019-08-26 20:55:47 UTC
Comment on attachment 206918 [details]

Looks good.

How about adding similar changes for gnome-|GNOME-terminal since that is another popular choice and was the application default?
Comment 26 Jim D. 2019-08-26 21:05:15 UTC
Created attachment 206934 [details]
Secpanel Configurations panel - were app default values may be changed
Comment 27 Jim D. 2019-08-26 21:14:06 UTC
(In reply to Walter Schwarzenfeld from comment #21)

Yes - a "pkg-message" might be helpful. A user might then able to create a "Secpanel default config" file that would better suit their environment, or use the "pre-filled-in sample config" file to start with (ie; copy/rename the "sample" file to the "default.config" file).

Also, if the running Secpanel does not pick up different local applications (ie; they don't appear in the Configurations panel drop-down selectors see attachment image of Configurations panel), then a user can modify their "<home>.secpanel/ config" file with the appropriate values. Much easier than trying to modify the TCL script to provide more options and recreate the user "config" file. It would might be helpful to include a brief comment about this as well.

It is frustrating to install an application (port) and then it doesn't work. All of this should help to eliminate that problem.
Comment 28 Walter Schwarzenfeld freebsd_triage 2019-08-26 22:30:50 UTC
(In reply to Jim D. from comment #25)
What you mean with similar changes?
Comment 29 Walter Schwarzenfeld freebsd_triage 2019-08-26 22:31:28 UTC
Created attachment 206935 [details]
Comment 30 Walter Schwarzenfeld freebsd_triage 2019-08-26 22:48:16 UTC
Created attachment 206936 [details]

Change the text of the pkg-message.
Comment 31 Walter Schwarzenfeld freebsd_triage 2019-08-26 22:50:32 UTC
Created attachment 206937 [details]

Attached wrong version.
Comment 32 Jim D. 2019-08-27 06:02:38 UTC
Comment on attachment 206937 [details]

"Similar changes": duplicate Makefile "do-install" changes for "MATE-TERMINAL" using "GNOME-TERMINAL".

Other note: shouldn't "set termtype(Mate...)..." be "set termtype(MATE...)..."?
Comment 33 Walter Schwarzenfeld freebsd_triage 2019-08-27 07:24:40 UTC
Created attachment 206949 [details]

Final version.
Comment 34 Jim D. 2019-08-28 13:10:46 UTC
Comment on attachment 206949 [details]

Umm - shouldn't "set termtype(Mate..." be "set termtype(MATE..." , or am I wrong?
Comment 35 Walter Schwarzenfeld freebsd_triage 2019-08-28 13:29:35 UTC
Created attachment 206974 [details]

Comment 36 Jim D. 2019-08-29 02:49:28 UTC
Comment on attachment 206974 [details]

Looks good.
Comment 37 commit-hook freebsd_committer 2019-08-29 10:22:08 UTC
A commit references this bug:

Author: pi
Date: Thu Aug 29 10:21:50 UTC 2019
New revision: 510151
URL: https://svnweb.freebsd.org/changeset/ports/510151

  security/secpanel: fix the mate-only case

  PR:		239832
  Submitted by:	Walter Schwarzenfeld <w.schwarzenfeld@utanet.at>
  Reported by:	Jim D. <radicleparticles@gmail.com>

Comment 38 Kurt Jaeger freebsd_committer 2019-08-29 10:22:56 UTC
Committed, thanks.