Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 10 Dec 2018, 17:59
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Gtkwialog
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [30 Posts]   Goto page: 1, 2 Next
Author Message
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sat 14 Jul 2018, 05:58    Post subject:  Gtkwialog
Subject description: Default mode is now mode B (forced bash)
 

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:
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
gtkwialog-0.8.7-i386.pet
Description 
pet

 Download 
Filename  gtkwialog-0.8.7-i386.pet 
Filesize  112.19 KB 
Downloaded  44 Time(s) 
gtkwialog-0.8.7-amd64.pet
Description 
pet

 Download 
Filename  gtkwialog-0.8.7-amd64.pet 
Filesize  103.32 KB 
Downloaded  38 Time(s) 
gtkwialog_0.8.7_i386.deb.tar
Description  Just remove the dummy tar before installing
tar

 Download 
Filename  gtkwialog_0.8.7_i386.deb.tar 
Filesize  89.4 KB 
Downloaded  46 Time(s) 
gtkwialog_0.8.7_amd64.deb.tar
Description  Just remove the dummy tar before installing
tar

 Download 
Filename  gtkwialog_0.8.7_amd64.deb.tar 
Filesize  82.16 KB 
Downloaded  42 Time(s) 

Last edited by wiak on Mon 13 Aug 2018, 23:42; edited 21 times in total
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3573
Location: holland

PostPosted: Sat 14 Jul 2018, 11:12    Post subject:  

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

_________________
Dog Linux website
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5195
Location: Ontario

PostPosted: Sat 14 Jul 2018, 11:34    Post subject:  

I'll compile it in fatdog64 710 to see if it works correctly.
_____________________________________________
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sat 14 Jul 2018, 12:14    Post subject:  

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, 12:58; edited 1 time in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sat 14 Jul 2018, 12:36    Post subject:  

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, 12:45; edited 3 times in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sat 14 Jul 2018, 12:39    Post subject:  

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
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sat 14 Jul 2018, 20:55    Post subject: 32bit version of gtkwialog also now uploaded  

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:
env GTKMODE=B program_name


For example (the not tested by me):

Code:
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
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sun 15 Jul 2018, 11:05    Post subject:  

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:
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, 02:18; edited 1 time in total
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3573
Location: holland

PostPosted: Sun 15 Jul 2018, 15:24    Post subject:  

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

_________________
Dog Linux website
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sun 15 Jul 2018, 17:49    Post subject:  

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 Sun 15 Jul 2018, 20:09; edited 1 time in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sun 15 Jul 2018, 19:56    Post subject:  

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 Wink 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.
pmusic_gtkwialog_dash.jpg
 Description   pmusic running over dash system via gtkwialog -B mode
 Filesize   23.7 KB
 Viewed   415 Time(s)

pmusic_gtkwialog_dash.jpg


Last edited by wiak on Sun 15 Jul 2018, 21:01; edited 2 times in total
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Sun 15 Jul 2018, 20:51    Post subject:  

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:
./autogen.sh


which automatically creates an appropriate 'configure' script.

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

Code:
./configure


Then I usually:

Code:
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.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3573
Location: holland

PostPosted: Mon 16 Jul 2018, 14:19    Post subject:  

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:
#!/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
bashisms_list.txt.gz
Description  remove fake .gz
gz

 Download 
Filename  bashisms_list.txt.gz 
Filesize  3.16 KB 
Downloaded  66 Time(s) 

_________________
Dog Linux website
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 1012
Location: not Bulgaria

PostPosted: Mon 16 Jul 2018, 17:33    Post subject:  

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.
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 5195
Location: Ontario

PostPosted: Wed 18 Jul 2018, 20:26    Post subject:  

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:
./autogen.sh  prefix=/usr
make 
make install



Here is terminal output
Quote:
# 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.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [30 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1150s ][ Queries: 12 (0.0104s) ][ GZIP on ]