Page 67 of 76

Posted: Sat 26 May 2018, 14:10
by rcrsn51
wiak wrote:When you say "same problem" I'm not sure what you mean.
When running in XenialPup32, I need to prefix <action> calls to exported functions with "bash -c ...".

Posted: Sat 26 May 2018, 14:13
by wiak
.

Posted: Sat 26 May 2018, 14:16
by rcrsn51
The good news is, backgrounding appears to work with quoting like this:

Code: Select all

<action>bash -c "FUNC &"</action>

Posted: Sat 26 May 2018, 14:22
by wiak
.

Posted: Sat 26 May 2018, 15:10
by rcrsn51
I tested the 64bit gtkwialog in Stretch-Live-64 and it works correctly, ie: <action>FUNC</action>

This also backgrounds correctly: <action>FUNC &</action>

Posted: Sat 26 May 2018, 16:48
by wiak
.

Posted: Sat 26 May 2018, 17:23
by rcrsn51
wiak wrote:So the results you were getting with the 32bit version may have been the correct results. Tomorrow will tell...wiak
That sounds like all gtkwialog apps, regardless of shell, would require <action>bash -c FUNC</action> to handle exported functions.

BTW, how will gtkwialog be more secure than gtkdialog? Either way, you are opening a new shell and running stuff in it.

Posted: Sat 26 May 2018, 19:15
by step
wiak wrote:@step: Something wrong with your code line:

Code: Select all

               <action>. "'"$0"'" @test 1 2 3</action> 
@wiak, sorry I don't have time to read the thread right now; you might have figured this out already by yourself, but let me explain those quotes.

Keep the line above in context. It's part of variable DIALOG, which is quoted within single quotes. So the first single quote after <action> closes the single quote at the start of the string: DIALOG='....<action>. "' You can see now that the string part is quoted correctly. The next single quote after <action> closes the single quote at the end of the DIALOG string: '" @test 1 2 3</action>...' You can see that it's quoted correctly. We're left with "$0" in the middle part. Double quoting is the way to quote $0 (it doesn't need to be exported) to protect embedded spaces _and_ enable shell variable expansion. Finally, why did I add double quotes in '..."' before "$0" and in '"...' after "$0"? Consider who's doing what. First the shell expands "$0" to /path\ with\ spaces/script.sh. That's right, the shell _removes_ double quotes upon expanding $0. Then shell also unquotes the single-quoted prefix and suffix and concatenates all the parts together to set DIALOG. At this point DIALOG holds ...<action>. "/path with spaces/script.sh"</action>.... Now you can see where those red double quotes come from. Finally, _gtkdialog_ - when it runs the action - passes the string . "/path with spaces/script.sh" to /bin/sh, which executes the command by sourcing the path. Without the double quotes, the shell would report a File Not Found error on a path with embedded spaces.

I use the quoting pattern '..."' "$varname" '"...' when I'm embedding shell fragments, such as variables expanding to pathnames, in other scripting languages, like gtkdialog and awk.

You wrote that my example didn't work for you. I don't know why. Did you add any single or double quotes, or backslash escaped double quotes? I can't maintain that the above quoting pattern is unbreakable, especially in the light of differently patched gtkdialog versions, which add their own quoting rules. And bash quoting can be inconsistent. See this post, for instance, about mid way through the bash cons, where it says "Extremely complicated and inconsistent rules".

I confess writing gtkdialog scripts isn't my favorite thing. If I can get away with yad I will do, though yad comes with its own set of strange things and limitations. I know you've done a lot of exploratory work on IUP. In fact, I have started a project folder complete with your pets and notes. But I can't find enough time to play with all the new toys... so IUP is on hold for me ATM.

Posted: Sat 26 May 2018, 19:43
by fredx181
Hi wiak,

I'm still testing but so far so good for me, congrats ! (tested your 32 bit mod)
I took existing script gdrive-gui2 (google-drive filemanager, my mod of mikeb's dropbox_gui) which is pretty complicated and having many "export -f " required functions.
So I changed all exported functions to "bash -c <function>" but one mistake, I made this(setting variable BUTTON):

Code: Select all

<action>BUTTON=3; bash -c add_selection</action>
That didn't work, took me a while to realize it had to be this:

Code: Select all

<action>bash -c "BUTTON=3; add_selection"</action
Ran the script after changing to sh > dash and everything OK.

Also ran the same modified script with sh > bash: also works OK.

Fine job ! Who knows, this will open new doors.

P.S. make sure you get enough sleep, take care of your health.
:wink:

Fred

Posted: Sat 26 May 2018, 23:21
by wiak
.

Posted: Sat 26 May 2018, 23:30
by wiak
fredx181 wrote:Hi wiak,

I'm still testing but so far so good for me, congrats ! (tested your 32 bit mod)
I took existing script gdrive-gui2 (google-drive filemanager, my mod of mikeb's dropbox_gui) which is pretty complicated and having many "export -f " required functions.
So I changed all exported functions to "bash -c <function>"

Ran the script after changing to sh > dash and everything OK.

Also ran the same modified script with sh > bash: also works OK.

Fine job ! Who knows, this will open new doors.

P.S. make sure you get enough sleep, take care of your health.
:wink:

Fred
Good to hear! Thanks Fred. Yes, alas I'm becoming a bit exhausted because I'm only managing a little sleep because of pain. Also that makes concentrating when programming difficult. I'll post binary for 64bit gtkwialog once I'm out of bed again, but might be a couple of days.

wiak

Posted: Sun 27 May 2018, 00:00
by wiak
.

Posted: Sun 27 May 2018, 00:43
by wiak
I'll start new thread for gtkwialog development/use discussions soonish to avoid further clogging up legacy gtkdialog tips thread

Posted: Sun 27 May 2018, 01:55
by technosaurus
wiak wrote:I'll start new thread for gtkwialog development/use discussions soonish to avoid further clogging up legacy gtkwialog tips thread
gtkdialog development thread

Posted: Sun 27 May 2018, 02:09
by wiak
.

Posted: Sun 27 May 2018, 02:51
by wiak
step wrote:
wiak wrote:@step: Something wrong with your code line:

Code: Select all

               <action>. "'"$0"'"
I use the quoting pattern '..."' "$varname" '"...' when I'm embedding shell fragments, such as variables expanding to pathnames, in other scripting languages, like gtkdialog and awk.
I have also often used that same quoting pattern to break things up so that wasn't the problem for me (probably used it in my domyfile app, cant remember where really), though your explanation of your intension in terms of its overall operation in this specific case is useful. No I didn't modify you example code at all - it just didn't work for me. I haven't had time to look into why.

Yes, I really think IUP is great. Has convenience advantages of yad and power of gtkdialog in a nicer syntax, and more power in addition to that. Alas, I too have been too occupied to use it further as yet.

Wiak

Posted: Sun 27 May 2018, 09:57
by wiak
.

Posted: Mon 28 May 2018, 02:42
by disciple
Hi guys,
Is anyone currently maintaining/developing an "upstream" gtkdialog? I thought thunor hadn't done anything on it for quite a while now.

I haven't followed this discussion too closely, so I'm afraid I may have missed a couple of things:
1. (not particularly relevant, but anyway:) any discussion of a context where this security concern was actually a real problem.
2. anyone actually suggesting that the changes in "gtkwialog" are undesirable, and current gtkdialog behaviour needs to remain the same.

It seems to me that:
- there is no upstream development , and
- there is some consensus that the old behaviour should be changed, and
- apps will only need relatively trivial changes to work with the new version.

If that is the case, forking seems rather gratuitous.
The world doesn't need yet another dialog program. It would be better for this to become upstream gtkdialog. Document and test the changes, get anyone interested to review it, and when it is ready release it with a new version number. We've survived changes in gtkdialog before; we can do it again.

Am I wrong?

Posted: Mon 28 May 2018, 03:10
by technosaurus

Posted: Mon 28 May 2018, 03:28
by disciple
Ah, thanks.
So it looks like Micko has taken over a very minimal "caretaker" maintenance role, and it would perhaps be worth having the discussion with him.