From vaxerdec at gmail.com Fri Nov 2 03:36:17 2007 From: vaxerdec at gmail.com (Scott) Date: Fri, 2 Nov 2007 02:36:17 -0700 Subject: [elinks-dev] confused about option use in session slaves Message-ID: <723ca5190711020236g3e92899q17ae7e87029cd412@mail.gmail.com> I am confused about the values shown by get_opt_() from the perspective of a session slave process. The code base I am using is GIT snapshot 0.12-20071028. It appears that only the session master obeys the configuration values set at runtime or in the configuration file. A slave instance which attaches to a master simply uses the compiled-in default for the option, regardless of its setting in a configuration file or to changes made to the option at runtime. Thus, there appears to be no way the value known to a slave can change at run-time. I see that load_config() is only called when the interlink socket cannot be established, meaning that it is a session master. This explains why default values overridden in the configuration file are not known to the slave processes. Does this also mean that a slave can never be "promoted" to a master if the master dies? Is there a design assumption that a slave process does not use options itself? I have tried killing a master to force promotion and see changed values with get_opt_ in the debugger, but even if the (former) slave is now the only process left, it still does not appear to get the right values from get_opt_() even though the option manager does appear to show modified values. I'm sure I am missing something obvious but I have been trying to figure this out for a while tonight and at this point am turning to the list membership for help in understanding. I can see that the slaves are intended to be little more than I/O repeaters between the master process and a terminal, but it seems that some options would be worthwhile for slaves to know about as well. Thank you for any insights. From vaxerdec at gmail.com Sat Nov 3 00:05:26 2007 From: vaxerdec at gmail.com (Scott) Date: Fri, 2 Nov 2007 23:05:26 -0700 Subject: [elinks-dev] [patch] don't resume terminal-stopped slave sessions Message-ID: <723ca5190711022305y3f604bal657cf633e32695e8@mail.gmail.com> I have made this patch to avoid having to fg-suspend-fg to get a slave session back if I have initially suspended it for longer than one second. I also find this behavior unpleasant because elinks loses its place in my shell's job control queue as being the default process to foreground without specifying a job number (because it is running in the background, even though I did not tell it to do that). It seems to me that automatically continuing suspended elinks sessions unrequested behind the back of the user is a bit mysterious and initially inexplicable for the naive user (like me ;) The following patch allows this behavior to affect the master only, and be configurable even in that case. Please let me know what you think. Thanks. diff -ur elinks-0.12-20071028/src/config/options.inc elinks-nosusp/src/config/options.inc --- elinks-0.12-20071028/src/config/options.inc 2007-10-27 15:40:03.000000000 -0700 +++ elinks-nosusp/src/config/options.inc 2007-11-02 22:33:29.000000000 -0700 @@ -1280,6 +1280,17 @@ "sessions", OPT_SORT, N_("Sessions settings.")), +#if defined (SIGCONT) && defined(SIGTTOU) + /* XXX see comment in signals.c to understand this */ + INIT_OPT_BOOL("ui.sessions", N_("Keep session master running"), + "keep_master_running", 0, 0, + N_("Cause a master suspended instance to revive itself\n" + "after 1s. Be aware that unsetting this option will\n" + "put the onus on the user to either keep the master\n" + "session running or start it in the background\n" + "and hangup the terminal.\n")), +#endif + INIT_OPT_BOOL("ui.sessions", N_("Keep session active"), "keep_session_active", 0, 0, N_("Keep the session active even if the last terminal exits.")), diff -ur elinks-0.12-20071028/src/osdep/signals.c elinks-nosusp/src/osdep/signals.c --- elinks-0.12-20071028/src/osdep/signals.c 2007-10-27 15:40:03.000000000 -0700 +++ elinks-nosusp/src/osdep/signals.c 2007-11-02 22:27:07.000000000 -0700 @@ -74,16 +74,40 @@ pid_t pid = getpid(); block_itrm(); + #if defined (SIGCONT) && defined(SIGTTOU) - if (!fork()) { - sleep(1); - kill(pid, SIGCONT); - /* Use _exit() rather than exit(), so that atexit - * functions are not called, and stdio output buffers - * are not flushed. Any such things must have been - * inherited from the parent process, which will take - * care of them when appropriate. */ - _exit(0); + /* + * If the master session is suspended, all slave + * instances will block waiting for it to resume. + * The following code is intended to prevent this by + * causing any terminal-stopped instance to be + * resumed after one second by a short-lived child + * that continues its parent. This is really only + * needed by the session master, but we do it + * unconditionally based on the setting of the + * config option. + * + * This works out fine because load_config() is + * never called from slave instances, so they will + * only use the compiled-in default for the option; + * slaves can be suspended happily without blocking + * any other instances, so it shouldn't ever be + * needed to enable this behavior in slave + * instances. + */ + if (get_opt_bool("ui.sessions.keep_master_running")) { + if (!fork()) { + sleep(1); + kill(pid, SIGCONT); + /* Use _exit() rather than exit(), + * so that atexit functions are not + * called, and stdio output buffers + * are not flushed. Any such things + * must have been inherited from the + * parent process, which will take + * care of them when appropriate. */ + _exit(0); + } } #endif raise(SIGSTOP); From kon at iki.fi Thu Nov 29 16:51:19 2007 From: kon at iki.fi (Kalle Olavi Niemitalo) Date: Fri, 30 Nov 2007 01:51:19 +0200 Subject: [elinks-dev] [patch] don't resume terminal-stopped slave sessions In-Reply-To: <723ca5190711022305y3f604bal657cf633e32695e8@mail.gmail.com> References: <723ca5190711022305y3f604bal657cf633e32695e8@mail.gmail.com> Message-ID: <878x4ga9vs.fsf@Astalo.kon.iki.fi> A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 188 bytes Desc: not available Url : http://linuxfromscratch.org/pipermail/elinks-dev/attachments/20071130/ce489f08/attachment.bin From simon1tan at yahoo.com Fri Nov 30 12:05:42 2007 From: simon1tan at yahoo.com (Simon Tan) Date: Fri, 30 Nov 2007 11:05:42 -0800 (PST) Subject: [elinks-dev] http_proxy with username and password Message-ID: <472911.55917.qm@web56111.mail.re3.yahoo.com> I exported the http_proxy variable with username and password like so: export HTTP_PROXY=http://username:password at host:port. Wget works, but elinks is unable to get online. Is elinks not able to parse the variable? If I enter the options and enter the proxy, username, password, elinks works fine. I understand there might be security concerns and stuff but if I save the password into a file(don't know if it's encrypted or not), same security concerns right. It would still be a nice feature. Could that be implemented in future versions? Thanks. Simon Tan, "Everybody needs a good Tan" Cell: (805) 234-0556 enagt.com & studentsolution.net simon1tan at yahoo.com ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs