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 Wed 11 Dec 2019, 15:10
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 89 of 99 [1478 Posts]   Goto page: Previous 1, 2, 3, ..., 87, 88, 89, 90, 91, ..., 97, 98, 99 Next
Author Message
rcrsn51


Joined: 05 Sep 2006
Posts: 12802
Location: Stratford, Ontario

PostPosted: Sat 26 May 2018, 10:10    Post subject:  

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

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

PostPosted: Sat 26 May 2018, 10:13    Post subject:  

.
Last edited by wiak on Thu 07 Jun 2018, 08:46; edited 1 time in total
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12802
Location: Stratford, Ontario

PostPosted: Sat 26 May 2018, 10:16    Post subject:  

The good news is, backgrounding appears to work with quoting like this:
Code:
<action>bash -c "FUNC &"</action>
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Sat 26 May 2018, 10:22    Post subject:  

.
Last edited by wiak on Thu 07 Jun 2018, 08:46; edited 1 time in total
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12802
Location: Stratford, Ontario

PostPosted: Sat 26 May 2018, 11:10    Post subject:  

I tested the 64bit gtkwialog in Stretch-Live-64 and it works correctly, ie: <action>FUNC</action>

This also backgrounds correctly: <action>FUNC &</action>
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Sat 26 May 2018, 12:48    Post subject:  

.
Last edited by wiak on Thu 07 Jun 2018, 08:47; edited 1 time in total
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 12802
Location: Stratford, Ontario

PostPosted: Sat 26 May 2018, 13:23    Post subject:  

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

Joined: 04 May 2012
Posts: 1224

PostPosted: Sat 26 May 2018, 15:15    Post subject:  

wiak wrote:
@step: Something wrong with your code line:

Code:
               <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.

_________________
Fatdog64-810|+Packages|Kodi|gtkmenuplus
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4208
Location: holland

PostPosted: Sat 26 May 2018, 15:43    Post subject:  

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:
<action>BUTTON=3; bash -c add_selection</action>

That didn't work, took me a while to realize it had to be this:
Code:
<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

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

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

PostPosted: Sat 26 May 2018, 19:21    Post subject:  

.
Last edited by wiak on Thu 07 Jun 2018, 08:47; edited 3 times in total
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Sat 26 May 2018, 19:30    Post subject:  

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

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

PostPosted: Sat 26 May 2018, 20:00    Post subject:  

.
Last edited by wiak on Thu 07 Jun 2018, 08:48; edited 4 times in total
Back to top
View user's profile Send private message 
wiak

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

PostPosted: Sat 26 May 2018, 20:43    Post subject:  

I'll start new thread for gtkwialog development/use discussions soonish to avoid further clogging up legacy gtkdialog tips thread
Last edited by wiak on Sat 26 May 2018, 22:15; edited 1 time in total
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4872
Location: Blue Springs, MO

PostPosted: Sat 26 May 2018, 21:55    Post subject:  

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

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
wiak

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

PostPosted: Sat 26 May 2018, 22:09    Post subject:  

.
Last edited by wiak on Thu 07 Jun 2018, 08:48; edited 1 time in total
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 89 of 99 [1478 Posts]   Goto page: Previous 1, 2, 3, ..., 87, 88, 89, 90, 91, ..., 97, 98, 99 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.2234s ][ Queries: 12 (0.1753s) ][ GZIP on ]