GtkDialog - tips
- misko_2083
- Posts: 114
- Joined: Tue 08 Nov 2016, 13:42
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
Depends. My example would not workwiak 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
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.- that can't of course be relied on.
No, as you said, your example would need #!/bin/bash at top.MochiMoppel wrote:Depends. My example would not workwiak 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
wiak
wiak_modded gtkdialog alpha result success
.
- 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.
That's great wiak, looks like your "gtkwialog" could become a useful program !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)
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
Yes, that will be possible.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.
----------------
wiak
Last edited by wiak on Sat 26 May 2018, 12:15, edited 2 times in total.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
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>MochiMoppel wrote:Can't confirm. This also requires <action>bash -c funcname</action>.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.
@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
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.
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan
I tried
Would work with original gtkdialog
Code: Select all
#!/bin/bash
testo () {
echo hello
};export -f testo
echo -n '
<button>
<action>testo</action>
</button>'| /root/tmp/gtkwialog_prealpha32 -s
I see the same problem. And this doesn't work either.MochiMoppel wrote:Can't confirm. This also requires <action>bash -c funcname</action>.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.
Code: Select all
<action>bash -c funcname &</action>
- MochiMoppel
- Posts: 2084
- Joined: Wed 26 Jan 2011, 09:06
- Location: Japan