Gtkwialog

Under development: PCMCIA, wireless, etc.
Message
Author
wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

Gtkwialog

#1 Post by wiak »

Since gtkwialog contains all gtkdialog functionality and more you can replace legacy gtkdialog with gtkwialog and make gtkdialog (gtkdialog3 etc) symlink(s) to the installed gtkwialog binary (though you can keep both on your system if you wish).

NOTE WELL: The default mode of this binary release is now mode B (forced bash). However, the github source code branches will be updated for both forced Bash (github branch bash_default) and forced legacy gtkdialog mode (github branch sh_default). For ease of implementation/use, DebianDog distributions currently prefer forced Bash mode (github branch bash_default).

Since this is first public (with source code) release, I am providing public downloads here for cutting-edge use on DebianDogs or Puppy Linux. I also want to avoid cluttering up main gtkwialog development programming topic threads (one started later may be merged back in to original dev thread), which contains some early documentation details:

http://www.murga-linux.com/puppy/viewtopic.php?t=113497
http://www.murga-linux.com/puppy/viewtopic.php?t=113598
--------------------------------

This is a first release of this version. Some of its functionality hasn't yet been tested at all (in particular: in-line -a, -b, -S modes). However, there has now been quite a bit of testing for running legacy gtkdialog apps on systems that use dash or ash or bash as there systems shells - so far most programs have worked without modification (apart from a few that needed their script shebang fixed to indicate they used bash functionality in their scripting (i.e. bashisms).

Since, by default, gtkwialog provides 100% drop-in replacement for legacy gtkdialog, previous gtkdialog-based apps can be tested by making gtkdialog a symlink to gtkwialog (USUAL DISCLAIMERS APPLY i.e. at your own risk, so back up your old gtkdialog before testing; however there have been no reports of any bugs).

Code: Select all

gtkwialog -v
gtkwialog version 0.8.7 release (C) 2003-2007 Laszlo Pere, 2011-2012 Thunor, 2018 William McEwan
Built with support for: GTK+ 2, Glade, VTE.
------------------------------------------------

From gtkwialog's source code provided README:

Gtkwialog is a fork of Gtkdialog, which provides alternative
<action> and <input> commandlinestring exec modes.
Should you ever want to force legacy gtkdialog mode, where /bin/sh is always used (rather than the default B mode = forced bash)
start your program with:

env GTKWMODE=S program_name

or alternatively, export GTKWMODE=S earlier into the environment.

However, in general, programs will simply work by default, no matter the system shell when gtkwialog is being used rather than legacy gtkdialog.

Naturally, if the main script ever employs bash functionality (bashisms),
such as export -f functionname, than the script shebang used must be
#!/bin/bash.

With no additional options specified via the environment, commandline
arguments or inline <action> or <input> commands, the default mode
of gtkwialog is 100% drop-in replacement for legacy gtkdialog. The default B (forced bash) mode can be changed, in increasing order of precedence, by:

1. setting optional environment variable GTKWMODE=?, where ? can be
a for glib async non-blocking (internally uses no shell process);
b for glib sync blocking (internally uses no shell process);
S to force /bin/sh (legacy gtkdialog mode);
unset, B, or anything else, means uses "default bash mode", which will
in any case will still work as a drop-in 100% legacy gtkdialog compatible
replacement (just make gtkdialog a symlink to gtkwialog).

2. The environment exec mode can be overwritten by cmdline args:
-a for glib async non-blocking; -b for glib sync blocking mode.
No commandline option is provides for S mode (so set GTKWMODE=S if
you happen to want the old (/bin/sh) legacy mode for whole dialog).
Forced bash B mode is otherwise the default mode.

3. Any action/input exec mode can be overwritten by inline <action> or
<input> args:

-a; -b; -B to uses /bin/bash with modded system calls; -S to use
legacy /bin/sh mode.

Current binary release is for 64bit systems (was developed and compiled on XenialDog64 (which conveniently allowed me to try with /bin/sh -> dash shell). I will compile and upload a 32bit version of the binary in a day or two probably.

Source code for this public test release is provided (at DebianDog repository):

https://github.com/DebianDog/Gtkwialog

Note that the organisation of this repository has been changed. The branch bash_default is now the default master branch (there is no branch named master) since that is what the current preferred binary is compiled from.

wiak
Attachments
gtkwialog-0.8.7-i386.pet
(112.19 KiB) Downloaded 320 times
gtkwialog-0.8.7-amd64.pet
(103.32 KiB) Downloaded 357 times
gtkwialog_0.8.7_i386.deb.tar
Just remove the dummy tar before installing
(89.4 KiB) Downloaded 341 times
gtkwialog_0.8.7_amd64.deb.tar
Just remove the dummy tar before installing
(82.16 KiB) Downloaded 327 times
Last edited by wiak on Tue 14 Aug 2018, 03:42, edited 21 times in total.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#2 Post by fredx181 »

Thanks wiak !!

Tested a few programs on Stretch64 (with dash as system-shell and gtkdialog symlinked to gtkwialog) and all worked well.
(pfind, peasyglue, dropboxgui, googledrivegui2, wex)
I'll test more later.
One thing: Is it not better to have GTKWMODE=B as the default ? (would be easier not having to set it, but you probably have your reasons).
On Stretch it worked for me by adding GTKWMODE=B to /etc/profile and works also by adding to /etc/environment (and did a reboot).

Fred

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#3 Post by don570 »

I'll compile it in fatdog64 710 to see if it works correctly.
_____________________________________________

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#4 Post by wiak »

fredx181 wrote: One thing: Is it not better to have GTKWMODE=B as the default ? (would be easier not having to set it, but you probably have your reasons).
On Stretch it worked for me by adding GTKWMODE=B to /etc/profile and works also by adding to /etc/environment (and did a reboot).

Fred


Yes, I hesitated on that one (making GTKWMODE=B the default), and it can be changed. But temporarily at least I wanted gtkwialog to be a simple drop-in replacement for gtkdialog as a default, which uses /bin/sh for execing commands (and somehow it seemed 'wrong' to force bash as default, when a script might be written that used no bashisms so bash not required). But, yes, I know, in practice these apps are all used on Puppy where /bin/sh links to bash anyway, and GTKWMODE=S could be used to force back /bin/sh instead of /bin/bash - I'm still considering the matter so opinions welcomed.

Meanwhile, I have messed something up in the recent code changes, so -a and -b modes not working correctly anymore it seems - must have done something daft since that should be easy... Anyway, I'm removing the download temporarily so as not to cause confusion till I fix that. However, you can continue testing with the one you have but you will find some bugs (including with inline -a and -b modes where I got the switch case statement wrong...). I should manage the bug fix quite quickly since all these known bugs likely be minor errors...

wiak
Last edited by wiak on Sat 14 Jul 2018, 16:58, edited 1 time in total.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#5 Post by wiak »

Re-uploaded the binary. Just fixed the inline -a -b modes case statement in the C sources, but never myself tested that part of the code yet anyway...

I had thought I had made a mistake with the commandline -a and -b modes, but think now that I hadn't. I simply forgot that these settings now apply to BOTH the <action> and the <input> tags. Previously I hadn't implemented -b for the <input> commands.

EDIT: what that means for me though is that I'll have to modify my cast2chrome program accordingly (since it uses -b mode of gtkwialog and I've only uses bash -c in the <action> commands of that and not the <input> ones - not a problem with new gtkwialog itself therefore). Actually I can use that as a test of the inline modes (mixed modes dialog), since I can use -B at the start of each <input>command and that should work... (i.e. -B followed by a single space) - EDIT2: A quick test suggests that is working too.

wiak
Last edited by wiak on Sat 14 Jul 2018, 16:45, edited 3 times in total.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#6 Post by wiak »

don570 wrote:I'll compile it in fatdog64 710 to see if it works correctly
Yes, the more tests the better in sorting out any issues, thanks.

wiak

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

32bit version of gtkwialog also now uploaded

#7 Post by wiak »

small fix applied and gtkwialog versions now uploaded to first post of this thread for both 32bit and 64bit systems.

Please test on as many legacy gtkdialog apps as possible, and also on systems that use dash as system shell via:

Code: Select all

env GTKMODE=B program_name
For example (the not tested by me):

Code: Select all

env GTKMODE=B pmusic
Pmusic (and Pburn) seems to contain a lot of gtkdialog widget functionality so may be a hard one to get working. Please let me know any and all results for any legacy gtkdialog apps so I can quickly attempt fixes for any bugs found.

wiak

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#8 Post by wiak »

fredx181 wrote: One thing: Is it not better to have GTKWMODE=B as the default ?
EDIT 22July2018: gtkwialog binaries in first post of this thread now use this default B (forced bash mode).

Hi Fred,

Been considering your above comment.

Luckily, the way I refactored the legacy gtkdialog code meant that I only have one widget-related source file to modify to make B mode default (rather than every one of the dozens of widget files, which would have been the case prior to my refactoring), along with three other main source files.

Though, as I said earlier, my gut instinct told me to make original gtkdialog /bin/sh mode the default, I recognise that making bash default could/would be more convenient. I've therefore quickly made a second copy of the source code and modded that so bash is default in the 32bit and 64bit binary deb files of gtkwialog attached below (I have left the first post with /bin/sh versions as default for comparison/testing). To indicate these use -B (bash) mode by default, I've added a _B to the deb name as shown (sorry, forgot to do that afterall - you just have to rename yourself if you wish...).

I haven't yet tested these but unless I've made a mistake these should allow legacy apps to run on systems which use bash or dash without modification nor need to set env variable. These use -B (bash) mode by default; to force /bin/sh mode, the user would start program with:

Code: Select all

env GTKWMODE=S progname
But it's true that legacy apps should work without that with the attached versions, since being -B (bash) mode by default the apps should simply 'work'.

Obviously, I don't want to have to support both alternatives, so I'll likely end up settling on whatever is implemented/used in practice or most often... At this stage it is easy enough to develop either.

Please test and let me know if these work and what you think. Opinions about which to settle on from anyone else interested are welcome and will help me decide which arrangement to go for.

wiak
Last edited by wiak on Sun 22 Jul 2018, 06:18, edited 1 time in total.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#9 Post by fredx181 »

Thanks, working well from what I tested without having to set GTKWMODE

Also made an attempt at testing pmusic on Upup Bionic.
First time I tested a puppy with symlinking sh to ash and found some problems (as I expected) with basic functions such as shutdown dialog not showing up and more (and could not setup save).
Anyway made symlink /usr/sbin/gtkdialog to /usr/bin/gtkwialog and ran pmusic.
However I'm really not familiar with the program, all seems to be working except playing radio streams, not a single one (does work when running pristiine Upup Bionic). My guess is that this has more to do with the system-shell set to ash then with gtkwialog.

If you ask me, I'd say it will be very difficult to properly transform a Puppy system to using sh > ash.
With Dog systems, I think it's very much doable now with gtkdialog symlinked to your new gtkwialog.

Fred

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#10 Post by wiak »

fredx181 wrote: Also made an attempt at testing pmusic on Upup Bionic.
Thanks Fred. I haven't tried pmusic, but just did a quick check of some of its many parts. Don't know if this could be the problem, but I note that in /usr/local/pmusic/pmusic there is a line (around line 262 on the copy I checked):

echo '#!/bin/sh' > $WORKDIR/exec

and same line (around line 163) in /usr/local/pmusic/func_player.

Maybe would work if these two lines were changed to(?): echo '#!/bin/bash' > $WORKDIR/exec

But I haven't tried. May get round to that some time - like you, I'm not familiar with the program so would be tricky to find out the issue otherwise.

wiak

EDIT: No, the above doesn't fix it. I tried pmusic in XenialDog64 and it worked in bash okay, but radio stations not playing under dash. I'll see if I can find out why, just in case some other file in gtkwialog needs a mod, though I doubt that too - but you never know, so worth investigating - but pmusic a huge multi-part program, so maybe I'll not manage myself with such lack of familiarity with it. Also I don't know what it uses to play radio streams, so have to find that out to check I have it in XenialDog.
EDIT2: Its streamripper, which my XenialDog has.
EDIT3: My suggestion to change these /bin/sh lines to /bin/bash seems to work afterall. It turned out some streamripper processes were originally left running in the background so I had to killall streamripper before trying pmusic under dash and radiostreams worked this time after above pmusic fixes implemented.
Last edited by wiak on Mon 16 Jul 2018, 00:09, edited 1 time in total.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#11 Post by wiak »

Screenshot showing pmusic working on XenialDog64 with /bin/sh -> dash following the small pmusic program fix detailed in my post above (/usr/local/pmusic scripts 'pmusic' and 'func_player' had 'wrong' #!/bin/sh shebang written to $WORKDIR/exec for executing radio streams since the resultant /tmp/.pmusic/exec shell script used bashism while [[...]]).

One of the disadvantages of using a system that has /bin/sh -> bash is that it unwittingly encourages the bad/wrong habit of using shebang #!/bin/sh when the script itself includes functionality only bash provides (i.e. bashisms). Nothing wrong with using bash, but must use appropriate #!/bin/bash shebang (and, if system shell itself is not bash, gtkwialog running in B mode!).

wiak

EDIT: Nice program Pmusic; amazing functionality for such a small program. However, if you just want to play radio streams, I note from 'top' utility that Dog Radio uses much less CPU (with firefox browser and Dog Radio my system is 85% idle; with firefox browser and Pmusic running my system CPU is only 43% idle - i.e. Pmusic uses much more CPU). However, if you want to use even less CPU, use cast2chrome with chromecast dongle over to your hi-fi system... I just get the radio stream url from right click on Dog Radio icon -> streaminfo and tick the cast2chrome url checkbox ;-) Then I get over 90% CPU idle on my system whist listening to streaming radio via cast2chrome/chromecast whislt browsing on firefox ... which reminds me that I'd better fix cast2chrome program for this new gtkwialog.
Attachments
pmusic_gtkwialog_dash.jpg
pmusic running over dash system via gtkwialog -B mode
(23.7 KiB) Downloaded 752 times
Last edited by wiak on Mon 16 Jul 2018, 01:01, edited 2 times in total.

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#12 Post by wiak »

don570 wrote:I'll compile it in fatdog64 710 to see if it works correctly.
_____________________________________________
Note that to compile gtkwialog, you need to first time run:

Code: Select all

./autogen.sh
which automatically creates an appropriate 'configure' script.

From that same top directory of the source code, you then do the usual:

Code: Select all

./configure
Then I usually:

Code: Select all

cd src

make
followed by binary stripping with:

strip --strip-uneeded etc...

There are a few compilation details I should probably automate a bit better, but it is simple enough as is.

wiak

EDIT: If you want the gtkdialog legacy terminal vte and glade capability built in, you first need to install the appropriate versions of libvte-dev and libglade-dev for your system. I did that for the gtkwialog versions I have published.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#13 Post by fredx181 »

Hi wiak, made a list for Stretch with the help of "checkbashisms" part of package "devscripts" to check from all packages in StretchDog custom repository (see attached):
https://linux.die.net/man/1/checkbashisms
Just extracted all packages and ran checkbashisms with this script:

Code: Select all

#!/bin/bash

# requires 'devscripts' package installed (checkbashisms is part of it)
# uncomment next to find/check all in /usr (or/and change as desired)
# cd /usr
# Or just run the next running in terminal standing in directory of choice, e.g. /usr/local/bin

find $PWD -type f | while IFS= read -r f
do
   if [[ "$(file ${f})" = @(*script*executable*) ]] ; then
checkbashisms "$f"
    if [ $? = "1" ]
    then
echo $f >> bashisms_list # send the scripts found containing bashisms to filelst
# uncomment if you want to change /bin/sh to /bin/bash directly in the found scripts
#        sed -i '1 s;/bin/sh;/bin/bash;' "$f"
    fi
   fi
done
This finds only bashisms for scripts with #!/bin/sh on top (and python scripts also, but can be ignored of course)

For XenialDog and Bionicdog it will be less (and possibly different) that needs modified shebang to bash.

I did already (partly) change scripts, re-packaged, made a testing repository, a testing system with sh > dash and all looks good.
Awful lot of work btw !! But it can be done.

Fred
Attachments
bashisms_list.txt.gz
remove fake .gz
(3.16 KiB) Downloaded 344 times

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#14 Post by wiak »

fredx181 wrote: This finds only bashisms for scripts with #!/bin/sh on top (and python scripts also, but can be ignored of course)

For XenialDog and Bionicdog it will be less (and possibly different) that needs modified shebang to bash.

I did already (partly) change scripts, re-packaged, made a testing repository, a testing system with sh > dash and all looks good.
Awful lot of work btw !! But it can be done.

Fred
Nice script and good idea. Lots of work as you say - just shows how slack we have all become though in terms of using wrong shebang when script contains bashisms...

wiak

EDIT: Note however how Pmusic was a 'tricky' case because all its actual scripts and functions correctly us #!/bin/bash as the shebang. Problem was that it auto-generated a script at run-time in which it wrongly put #!/bin/sh as the shebang... So zigbert obviously put in the effor to get it correct but simply missed the auto-generated script shebang. I found the problem cases in Pmusic simply by grep(ing) all its files for /bin/sh and came across the two errant lines... had no idea what they were used in at the time (though did thereafter check the auto-generated script out to see what it did and noticed its internal bashism, which I could have altered instead) so a bit of luck there really since found and fixed the problem in minutes. For system scripts where execution efficiency is affected it is often best to remove bashisms altogether and continue to use /bin/sh, but with gtkdialog apps the efficiency gains would likely be unnoticable (most of the time), so bash with gtkdialog/gtkwialog is a perfectly good (and powerful) combination for most human interface parts of the code anyway.

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#15 Post by don570 »

No problems so far on fatdog 64
Pfind 4.21 works without a change.
My scripts work fine.

I compiled in fatdog64 710 with

Code: Select all

./autogen.sh  prefix=/usr
make  
make install

Here is terminal output
# gtkdialog -v
gtkwialog version 0.8.5 release (C) 2003-2007 Laszlo Pere, 2011-2012 Thunor, 2018 William McEwan
Built with support for: GTK+ 2, Glade, VTE.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#16 Post by fredx181 »

Hi wiak, cast2chrome works with gtkwialog 0.8.4, but seems not with 0.8.5 (see pic).

I'm testing with sh > dash now on Xenialdog, did set up testing repo with upgradable packages (with bashisms problem fixed).
Everything seems fine, except cast2chrome. Are you planning to make a new version ?
If not, I can find some construction with the gtkwialog v0.8.4 installed as well.

Fred
Attachments
2018-07-19-120841_608x511_scrot.png
cast2chrome with gtkwialog 0.8.5 installed
(60.35 KiB) Downloaded 750 times

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#17 Post by wiak »

fredx181 wrote:Hi wiak, cast2chrome works with gtkwialog 0.8.4, but seems not with 0.8.5 (see pic).
Yes, I actually mentioned that I have to fix cast2chrome for the new gtkwialog but I've been too busy to get round to it. I will remove the upload for now because I'm a bit busy on something else at the moment. I know the cast2chrome fix and already made it but have to re-test before uploading the new version. It's because the latest gtkwialog is more complete and cast2chrome was written on the basis of the older only partially complete -b mode.

wiak

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#18 Post by wiak »

fredx181 wrote:Hi wiak, cast2chrome ... seems not with 0.8.5
Hi Fred,

I fixed cast2chrome to work with the new gtkwialog 0.8.5 and uploaded it to its usual thread:

http://www.murga-linux.com/puppy/viewtopic.php?t=113314

Tested and should work fine now on bash or dash or ash (out-of-the-box without env var required since uses gtkwialog -b mode).

wiak

wiak
Posts: 2040
Joined: Tue 11 Dec 2007, 05:12
Location: not Bulgaria

#19 Post by wiak »

With no bugs identified this far, I intend to also make dotpets for gtkwialog within the next couple of days (it will be needed, even in Puppy, which always uses bash as its system shell, if you use cast2chrome or the new makegit program I am creating).

wiak

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#20 Post by fredx181 »

Thanks wiak !

Just to be sure I ask, the new cast2chrome works also OK with the gtkwialog "B" package ?

I made the setup possible for Xenialdog with system-shell using dash, see here:
http://murga-linux.com/puppy/viewtopic. ... 553#999553
The new "gtkdialog" package is version 0.8.5-wiak-B, has symlinks gtkdialog4, gtkdialog3 and gtkdialog to gtkwialog.
I think you said earlier that such a construction is OK with you, anyway, just tell me if you'd like it different.

I've decided not to touch Stretch(Dog), mainly because it has some side projects going on, so things may become confusing.
Next will be BionicDog to work on further (probably I'll do new ISO release with the change to dash)

Fred

Post Reply