GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
misko_2083
Posts: 114
Joined: Tue 08 Nov 2016, 13:42

#1301 Post by misko_2083 »

check this line in actions.c
This is how the actions are executed
https://github.com/01micko/gtkdialog/bl ... ons.c#L664

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

#1302 Post by wiak »

.
Last edited by wiak on Thu 07 Jun 2018, 12:42, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#1303 Post by MochiMoppel »

wiak wrote:Certainly shouldn't be using #!/bin/sh if the code inside is actually using bashisms (even though that would still work on Puppy systems since /bin/sh is linked to bash there
Depends. My example would not work
- that can't of course be relied on.
Not sure what "that" refers to but it is true in any case: It can't be relied on that sh is linked to bash and it can't be relied on that sh linked to bash can process bash specific code.

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

#1304 Post by wiak »

MochiMoppel wrote:
wiak wrote:Certainly shouldn't be using #!/bin/sh if the code inside is actually using bashisms (even though that would still work on Puppy systems since /bin/sh is linked to bash there
Depends. My example would not work
No, as you said, your example would need #!/bin/bash at top.

wiak

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

wiak_modded gtkdialog alpha result success

#1305 Post by wiak »

.
Attachments
screenshot_using_wiakmodded_gtkdialog.jpg
Screenshot using wiak modded gtkdialog
(29.61 KiB) Downloaded 273 times
Last edited by wiak on Thu 07 Jun 2018, 12:42, edited 2 times in total.

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

#1306 Post by fredx181 »

wiak wrote:Success! Thus far at least.
....
....
EDIT:
THE PROBLEM, is that, whilst I wish gtkdialog had been like that in the first case (i.e. not using the, generally unsafe, C system call like it does) much of gtkdialog we know probably will not work as we have come to expect since my modded version does not use /bin/sh -c and hence does not interpret the supplied <action> command as a string but rather as an actual command (if you see what I mean). So, for example, <action>echo $0 >/dev/tty</action> would not give you the result (output to the current terminal)
That's great wiak, looks like your "gtkwialog" :wink: could become a useful program !
I am mostly interested in what's required to change in existing scripts in case using your mod (and in case sh > dash or busybox). That looks like it's easier than with existing gtkdialog. As far as I can understand, the changes should be: bash -c <function_name> rather than just <function_name> ? (but probably not that only, I have the feeling).

Fred

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#1307 Post by rcrsn51 »

So "gtkwialog" could be added to Fred's repo as a separate item?

Then people who want to build new apps using it can do so, without worrying about side-effects on older gtkdialog apps.

Or people could gradually upgrade their gtkdialog apps to gtkwialog after proper testing.

----------------

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

#1308 Post by wiak »

rcrsn51 wrote:So "gtkwialog" could be added to Fred's repo as a separate item?

Then people who want to build new apps using it can do so, without worrying about side-effects on older gtkdialog apps.

Or people could gradually upgrade their gtkdialog apps to gtkwialog after proper testing.

----------------
Yes, that will be possible.

wiak
Last edited by wiak on Sat 26 May 2018, 12:15, edited 2 times in total.

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

#1309 Post by wiak »

.
Last edited by wiak on Thu 07 Jun 2018, 12:43, edited 5 times in total.

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

A couple of test binaries

#1310 Post by wiak »

.
Last edited by wiak on Thu 07 Jun 2018, 12:44, edited 3 times in total.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#1311 Post by rcrsn51 »

@wiak. Thanks.

Could you provide a quick list of the main changes needed to switch an app from gtkdialog to gtkwialog?

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

#1312 Post by wiak »

.
Last edited by wiak on Thu 07 Jun 2018, 12:44, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#1313 Post by MochiMoppel »

wiak wrote:Quickest, is when /bin/sh still is link to bash then all you need is to change gtkdialog reference in your code to gtkwialog.
Can't confirm. This also requires <action>bash -c funcname</action>.

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

#1314 Post by wiak »

MochiMoppel wrote:
wiak wrote:Quickest, is when /bin/sh still is link to bash then all you need is to change gtkdialog reference in your code to gtkwialog.
Can't confirm. This also requires <action>bash -c funcname</action>.
No, it doesn't. I'll recheck though. If your script is a bash script (i.e. starts with #!/bin/bash or wherever bash is) and your system has /bin/sh as a link to bash, you just need the usual <action>function_name</action>

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

#1315 Post by wiak »

@MochiMoppel:

See attached screenshot showing the code and result including just started up rox filemanager. No bash -c needed in this case. By the way, ignore it saying 'gtkdialog' in the code below, it's gtkwialog before name being changed.

I'm not saying there won't be other things that do need changed a bit (particularly if quoting involved). There may or may not be. Needs tested and any new rules documented.

wiak
Attachments
screenshot.jpg
(37.7 KiB) Downloaded 195 times
Last edited by wiak on Sat 26 May 2018, 13:41, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#1316 Post by MochiMoppel »

I tried

Code: Select all

#!/bin/bash
testo () {
echo hello
};export -f testo

echo -n '
<button>
<action>testo</action>
</button>'| /root/tmp/gtkwialog_prealpha32 -s
Would work with original gtkdialog

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

#1317 Post by wiak »

.
Last edited by wiak on Thu 07 Jun 2018, 12:45, edited 1 time in total.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#1318 Post by rcrsn51 »

MochiMoppel wrote:
wiak wrote:Quickest, is when /bin/sh still is link to bash then all you need is to change gtkdialog reference in your code to gtkwialog.
Can't confirm. This also requires <action>bash -c funcname</action>.
I see the same problem. And this doesn't work either.

Code: Select all

<action>bash -c  funcname &</action>

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

#1319 Post by wiak »

.
Last edited by wiak on Thu 07 Jun 2018, 12:45, edited 1 time in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#1320 Post by MochiMoppel »

wiak wrote:The code Mochi... posted worked perfectly on my XenialDog64 system with gtkwialog...64 version.
Mochi used gtkwialog_prealpha32 ...

Post Reply