zdia / gorilla

Password Gorilla manages passwords
420 stars 61 forks source link

bad pad value on Remnux #221

Closed SavSanta closed 2 years ago

SavSanta commented 2 years ago

Greetings, how can I investigate this error more in-depthly?

It seems to only appear for me in my Remnux v7 image I have in my VMWorkstation when running password-gorilla 1.5 or 1.60 beta.

It would seem it has something to do with this the desktop environment...maybe? Basically after the initial Open a Database GUI window is created when trying to create or open a psafe3 database it crashes out with one of the below error messages (depending on if run with --no-rc or not)

remnux@remnux:/tmp/sources$ tclsh gorilla.tcl 
bad pad value "1m": must be positive screen distance
    while executing
"grid [ ttk::label       $pbar.label -text [ format $message 0 ] ] {*}$opts -pady {1m 0}"
    (procedure "::gorilla::progress::init" line 24)
    invoked from within
"::gorilla::progress init -win $aframe.info -message [ mc "Opening ... %d %%" ] -max 200 "
    (procedure "OpenDatabase" line 184)
    invoked from within
"OpenDatabase [mc "Open Password Database"] $defaultFile 1"
    (procedure "gorilla::Open" line 32)
    invoked from within
"gorilla::Open"
    invoked from within
"if {$haveDatabaseToLoad} {
    set action [gorilla::Open $databaseToLoad]
} else {
    set action [gorilla::Open]
}"
    (file "gorilla.tcl" line 8780)
remnux@remnux:/tmp/sources$  gorilla.tcl

or

remnux@remnux:/tmp/sources$ password-gorilla --norc
bad pad value "1m": must be positive screen distance
    while executing
"grid [ ttk::label       $pbar.label -text [ format $message 0 ] ] {*}$opts -pady {1m 0}"
    (procedure "::gorilla::progress::init" line 24)
    invoked from within
"::gorilla::progress init -win $aframe.info -message [ mc "Opening ... %d %%" ] -max 200 "
    (procedure "OpenDatabase" line 169)
    invoked from within
"OpenDatabase [mc "Open Password Database"] $defaultFile 1"
    (procedure "gorilla::Open" line 32)
    invoked from within
"gorilla::Open"
    invoked from within
"if {$haveDatabaseToLoad} {
    set action [gorilla::Open $databaseToLoad]
} else {
    set action [gorilla::Open]
}"
    (file "/usr/share/password-gorilla/gorilla.tcl" line 9326)
remnux@remnux:/tmp/sources$ password-gorilla --norc
bgerror failed to handle background error.
    Original error: bad pad value "1m": must be positive screen distance
    Error in bgerror: bad pad value "3m": must be positive screen distance
remnux@remnux:/tmp/sources$ password-gorilla --norc
bad pad value "1m": must be positive screen distance
    while executing
"grid [ ttk::label       $pbar.label -text [ format $message 0 ] ] {*}$opts -pady {1m 0}"
    (procedure "::gorilla::progress::init" line 24)
    invoked from within
"::gorilla::progress init -win $aframe.info -message [ mc "Opening ... %d %%" ] -max 200 "
    (procedure "OpenDatabase" line 169)
    invoked from within
"OpenDatabase [mc "Open Password Database"] $defaultFile 1"
    (procedure "gorilla::Open" line 32)
    invoked from within
"gorilla::Open"
    invoked from within
"if {$haveDatabaseToLoad} {
    set action [gorilla::Open $databaseToLoad]
} else {
    set action [gorilla::Open]
}"
    (file "/usr/share/password-gorilla/gorilla.tcl" line 9326)

TCL Info

remnux@remnux:/tmp/sources$ sudo apt show info tcl
Package: info
Version: 6.5.0.dfsg.1-2
Priority: standard
Section: doc
Source: texinfo
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian TeX maintainers <debian-tex-maint@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 599 kB
Provides: info-browser
Depends: libc6 (>= 2.15), libtinfo5 (>= 6), install-info
Suggests: texinfo-doc-nonfree
Replaces: texinfo (<< 4.7-2)
Task: standard
Supported: 5y
Download-Size: 104 kB
APT-Manual-Installed: yes
APT-Sources: http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Description: Standalone GNU Info documentation browser
 The Info file format is an easily-parsable representation for online
 documents. This program allows you to view Info documents, like the
 ones stored in /usr/share/info.
 .
 Much of the software in Debian comes with its online documentation in
 the form of Info files, so it is most likely you will want to install it.

Package: tcl
Version: 8.6.0+9
Priority: optional
Section: universe/interpreters
Source: tcltk-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Tcl/Tk Packagers <pkg-tcltk-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 21.5 kB
Provides: tclsh
Depends: tcl8.6 (>= 8.6.0-2)
Breaks: tcl8.3 (<< 8.3.5-15), tcl8.4 (<< 8.4.20-2), tcl8.5 (<< 8.5.14-3), tcl8.6 (<< 8.6.0-2)
Task: ubuntustudio-audio
Supported: 3y
Download-Size: 5,146 B
APT-Manual-Installed: no
APT-Sources: http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Description: Tool Command Language (default version) - shell
 Tcl is a powerful, easy to use, embeddable, cross-platform interpreted
 scripting language.
 .
 This package is a dependency package, which depends on Debian's default
 Tcl version (currently 8.6).
rich123 commented 2 years ago

It does appear to be an issue with Tk and determining the screen resolution (note, this is something Tk handles internally, the PasswordGorilla code simply makes use of Tk's "screen distance measurements" that it offers to TCL code).

Two things to try.

First: from a "wish" console, type in:

tk scaling

and see what is reported. On my X11/Linux system this returns:

$ rlwrap wish 
% tk scaling
1.3359631821170281
% 

I am going to guess you might see a negative number here. If yes, then you've found the cause to the extent of what is causing Tk to have issues with the "1m" screen distance specification. This would be a problem between the display driver Tk is talking to and Tk itself and there would not be anything that can be done at the PasswordGorillia code level to fix the issue. And if you do see a negative number, then this is also an issue to report to the TCL/Tk maintainers at https://core.tcl-lang.org/tk/reportlist.

Second, if that returns a positive number above, then the equivalent minimal code that 'should' trigger the issue is:

#!/usr/bin/wish                                        
ttk::label .l -text "Hello"
grid .l -pady {1m 0}

This just sets up a single ttk::label widget, then attempts to grid it with a Y axis padding of 1m on top -- same as the error report code from the stack trace. This likely will generate the same abort about needing positive screen distances, and if so would indicate that the problem lies somewhere inside Tk's machinery to detect screen resolution and determine the scale factor to convert "millimeters" of distance on screen into a number of pixels. And this would also again be an issue to report to the Tk maintainers. The PWGorilla Tcl code just uses the "millimeter" measurement option, it depends on Tk itself (the TCL windowing code) to convert millimeters into pixels.

SavSanta commented 2 years ago

Mr rich123,

You seem to be correct a quick test confirmed it is not password-gorilla resolvable matter. Thanks you assistance. havent used TCL\TK in a minute and forgot how to diagnose/debug issues.

Output for complete edification actually says the scaling is inf (presumably for infinite). Posted below:

remnux@remnux:/tmp/sources$ wish
% tk scaling
Inf
% ttk::label .l -text "Hello"
.l
% grid .l -pady {1m 0}
bad pad value "1m": must be positive screen distance
% 

Cheers. Closing this out will work on submitting it upstream to tcl\tk team for their thoughts

rich123 commented 2 years ago

Yes, "Inf" is Tcl's floating point string value for an IEEE floating point "infinity" value. So there is clearly something wrong somewhere in Tk's algorithm for computing that scale factor. It may be a Tk bug, or it may be bogus data from the display driver within the VM being sent to Tk. In either case it is an item for the Tk maintainers to puzzle over.