On Mon, 28 Aug 2006 05:04:10 +0100
Essien Ita Essien <[EMAIL PROTECTED]> wrote:
Ouch, sorry, lol :)
Here it is
> Eugen Minciu wrote:
> > On Sun, 27 Aug 2006 23:22:38 +0300
> > Eugen Minciu <[EMAIL PROTECTED]> wrote:
> > And finally, I've got it.
> >
> > The problem was in entrance_auth_setup_environment() which called
> > clearenv().
> >
> > For some reasong calling getenv() there did not return the path either. So
> > I added an extra parameter, const char *path.
> >
> > This finally works, I can run apps and everything appears to be working
> > correctly.
> >
> Nice, but no patch attached ;)
> > Eugen.
> >
> >> On Sun, 27 Aug 2006 22:36:31 +0300
> >> Eugen Minciu <[EMAIL PROTECTED]> wrote:
> >> I've figured out what causes the problem, but I don't know how to fix it
> >> this time.
> >>
> >> This happens because once I replace the execl() call in
> >> entrance_session_start_user_session, the environment variables for the
> >> user are no longer loaded. If anyone could tell me how to load these
> >> settings from C code, I'd very much appreciate it.
> >>
> >> As things stand, at this point, entrance does work with this, and the E17
> >> session starts, but many issues can quickly be noticed, probably caused by
> >> not setting the environment variables to some proper values.
> >>
> >>
> >>> On Sun, 27 Aug 2006 22:30:58 +0300
> >>> Eugen Minciu <[EMAIL PROTECTED]> wrote:
> >>>
> >>> Sorry, it seems that if I use this I get some issues within e. If I try
> >>> to start an application from the run command thingie, it will tell me
> >>> that the application failed to start.
> >>>
> >>> I'll try to see what causes this. If anyone would be willing to
> >>> investigate and/or give me any clues it would be appreciated.
> >>>
> >>>
> >>>> Here's a new patch for entranced and entrance.
> >>>>
> >>>> This time I did what the comment suggested in both places. I used strtok
> >>>> and parsed directly into a char ** which then gets run by execv/execvp.
> >>>>
> >>>> If my code strikes you as ugly (I'm not sure if it should) be sure to
> >>>> tell me what I did wrong and I'll try to fix it some more.
> >>>>
> >>>> BTW, this diff is made from e17/apps/entrance. I'm sorry, is this what
> >>>> you meant or should I have made it dirrectly from e17/ ?
> >>>>
> >>>> Eugen.
> >>>>
> >>>>
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
> >
>
? entrance_no_shell.diff
? doc/html
? doc/latex
? doc/man
? src/client/entrace_session_try_bash.diff
Index: src/client/entrance_auth.c
===================================================================
RCS file: /var/cvs/e/e17/apps/entrance/src/client/entrance_auth.c,v
retrieving revision 1.26
diff -u -r1.26 entrance_auth.c
--- src/client/entrance_auth.c 9 Aug 2005 08:11:32 -0000 1.26
+++ src/client/entrance_auth.c 28 Aug 2006 03:23:14 -0000
@@ -377,7 +377,7 @@
* I'm not sure if this is correct, but for now it works.
*/
void
-entrance_auth_setup_environment(Entrance_Auth * e, const char *display)
+entrance_auth_setup_environment(Entrance_Auth * e, const char *display, const
char *path)
{
extern char **environ;
int size;
@@ -394,10 +394,14 @@
environ = NULL;
#endif
+ /* We purge the config but keep $PATH in place */
+ /* We need this because we're not running "sh -l" anymore */
+
e->env = environ;
snprintf(buf, PATH_MAX, "%s/.Xauthority", e->pw->pw_dir);
setenv("XAUTHORITY", buf, 1);
setenv("TERM", "vt100", 0); // TERM=linux?
+ setenv("PATH", path, 1);
setenv("HOME", e->pw->pw_dir, 1);
setenv("SHELL", e->pw->pw_shell, 1);
setenv("USER", e->pw->pw_name, 1);
@@ -410,6 +414,7 @@
snprintf(mail, size, "%s/%s", _PATH_MAILDIR, e->pw->pw_name);
setenv("MAIL", mail, 1);
free(mail);
+ free(path);
chdir(e->pw->pw_dir);
}
Index: src/client/entrance_auth.h
===================================================================
RCS file: /var/cvs/e/e17/apps/entrance/src/client/entrance_auth.h,v
retrieving revision 1.13
diff -u -r1.13 entrance_auth.h
--- src/client/entrance_auth.h 28 May 2005 09:31:14 -0000 1.13
+++ src/client/entrance_auth.h 28 Aug 2006 03:23:14 -0000
@@ -77,7 +77,7 @@
/* 0 on success, 1 on no user by that name */
int entrance_auth_user_set(Entrance_Auth * e, const char *str);
-void entrance_auth_setup_environment(Entrance_Auth * e, const char *display);
+void entrance_auth_setup_environment(Entrance_Auth * e, const char
*display,const char *path);
void entrance_auth_reset(Entrance_Auth * e);
#endif
Index: src/client/entrance_session.c
===================================================================
RCS file: /var/cvs/e/e17/apps/entrance/src/client/entrance_session.c,v
retrieving revision 1.84
diff -u -r1.84 entrance_session.c
--- src/client/entrance_session.c 3 Jun 2006 07:24:49 -0000 1.84
+++ src/client/entrance_session.c 28 Aug 2006 03:23:14 -0000
@@ -356,7 +356,7 @@
{
char *homedir;
- entrance_auth_setup_environment(e->auth, e->display);
+ entrance_auth_setup_environment(e->auth, e->display,
strdup(getenv("PATH")));
homedir = getenv("HOME");
if (entrance_ipc_connected_get())
entrance_ipc_request_xauth(homedir, e->auth->pw->pw_uid,
@@ -377,14 +377,20 @@
{
pid_t pid;
char buf[PATH_MAX];
+ char *session_cmd_argv[32];
+
char *shell = NULL;
struct passwd *pwent = NULL;
Entrance_X_Session *exs = NULL;
+ int i;
+
+ for (i=0;i<32;i++) session_cmd_argv[i]=NULL;
+
if (e->session)
exs = evas_hash_find(e->config->sessions.hash, e->session);
- entrance_auth_setup_environment(e->auth, e->display);
+ entrance_auth_setup_environment(e->auth, e->display,
strdup(getenv("PATH")));
if ((exs->session) && (exs->session[0] != 0))
{
if (!strcmp(exs->session, "default"))
@@ -497,7 +503,13 @@
entrance_session_free(e);
/* replace this process with a clean small one that just waits for its */
/* child to exit.. passed on the cmd-line */
- execl("/bin/sh", "/bin/sh", "-l", "-c", buf, NULL);
+
+ session_cmd_argv[0]=strtok(buf," ");
+ i=1;
+ while ((session_cmd_argv[i]=strtok(NULL," "))!=NULL) {
+ i++;
+ }
+ execvp(session_cmd_argv[0], session_cmd_argv);
}
Index: src/daemon/entranced_display.c
===================================================================
RCS file: /var/cvs/e/e17/apps/entrance/src/daemon/entranced_display.c,v
retrieving revision 1.2
diff -u -r1.2 entranced_display.c
--- src/daemon/entranced_display.c 1 Aug 2006 05:30:58 -0000 1.2
+++ src/daemon/entranced_display.c 28 Aug 2006 03:23:16 -0000
@@ -124,6 +124,11 @@
double start_time;
char x_cmd[PATH_MAX];
+ int i;
+ char *x_cmd_argv[32];
+
+ for (i=0;i<32;i++) x_cmd_argv[i]=NULL;
+
/* Ecore_Exe *x_exe; */
pid_t xpid;
@@ -160,9 +165,15 @@
_entrance_x_sa.sa_flags = 0;
sigemptyset(&_entrance_x_sa.sa_mask);
sigaction(SIGUSR1, &_entrance_x_sa, NULL);
- /* FIXME: need to parse command and NOT go thru /bin/sh!!!! */
- /* why? some /bin/sh's wont pass on this SIGUSR1 thing... */
- execl("/bin/sh", "/bin/sh", "-c", x_cmd, NULL);
+
+ x_cmd_argv[0]=strtok(x_cmd," ");
+ i=1;
+
+ while ((x_cmd_argv[i]=strtok(NULL," "))!=NULL) {
+ i++;
+ }
+
+ execvp(x_cmd_argv[0], x_cmd_argv);
syslog(LOG_WARNING, "Could not execute X server.");
exit(1);
default:
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel