[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] New patch for entranced and entrance




Eugen Minciu wrote:
> Hi, here's another patch for entrance.
>
> OK, I've done this acccording to what raster told me, I hope I
> understood these things properly.
>
> 1) A shell should be run, so the users's profile is loaded. After
> thinking about it, this is a great idea indeed, this way if I have a
> ~/bin in my PATH my wm can run those applications directly (no strings
> attatched) and it's the right thing to do.
>
> 2) The first attempted shell should be the users's shell. This is
> almost guaranteed to have -l. We only try to run this if the shell
> isn't "".
>
> 3) We run /bin/sh -l. If the users's shell with a '-l' didn't work
> (maybe because it was uninstalled or something) we may get to this point.
>
> 4) If the above didn't work, we log a warning message and try to run
> "/bin/sh" without -l anyway. Note that the users's PATH, will probably
> not be setup properly in this case (at least for me programs in
> /usr/local/bin weren't available with the run thingie and my eapps in
> the favorite applications menu were missing)
>
> Oh, btw does the run thingie have a name so I can stop calling it the
> run thingie? :)
Ofcourse the run thingie has a name silly... its called the... uhmm...
uhmmm... run thingie? ;)
>
> 5) If the above failed as well (the user's shell is uninstalled and
> /bin/sh was linking to it or whatever) we log an error message and cry
> :((
>
> Some things that should me noted about my patch
> 1) As before, X isn't started through a shell anymore. The cmdline is
> parsed and executed directly, since this was desired.
>
> 2) I've cleaned up the code in entrance_session_start_user_session if
> a few ways.
> a) there was a 'shell' variable which wasn't getting used. I found a
> good use for it.
> b) the current code is structured in a weird way imho. The call to
> execl() is outside the fork switch, so, somehow, it would call the
> session in the child pid and recall entrance_login in the parent pid.
>
> Why would we want to do that? X will restart and entrance_login will
> get called again anyway, when the program exits.
>
> In my patch, the parent calls wait(), holding its pants on until the
> child's session ends. No more sleep(), less code in the function and
> things look a bit more normal().
>
> 3) In _entrance_session_execute_in_shell, each shell is called inside
> a fork, and waited for by the parent process. This is done so we can
> catch errors like 'sh: Illegal option -l'. Is this in any way wrong?
>
> 4) Oh, and ecore_x_shutdown(); and ecore_shutdown() are being called
> now, just like the TODO says.
>
> 5) I've tested it in three ways.
> - working user shell
> - user shell not working, sh is a login shell
> - user shell not working, sh is not a login shell.
> Everything went well in all these circumstances.
>
>
> That's about it. Is this one any good?
oi! Patch looks visually good to me... I'll proceed with aforementioned
testing :)
Really good work. Thnx a mill.
> Cheers,
> Eugen.
>
> PS: Congrats Essien for changing the session handling. It works great now.
goodie! We're getting close to actual usability now :)
>
>
> On 8/29/06, *The Rasterman Carsten Haitzler* <raster@rasterman.com
> <mailto:raster@rasterman.com>> wrote:
<snip>
> +
> +   /* If /bin/sh isn't a login shell run /bin/sh without loading the profile
> +    * Also log a warning because this will probably not behave correctly */
>   
actually here instead of logging this quietly to syslog, we should alert
the user via an Entrance_Dialog <--this doesn't exist yet :), By the
time I move entrance_edit_gui into entrance main, we should have ways to
talk to the user. Its on the Entrance TODO too, to be able to
communicate to the user on failed sessions. I'll try to speed the work
on this up so we can also have that option.
> +   if (WEXITSTATUS(status)==2) { 
> +      syslog(LOG_NOTICE, "Neither '%s' or '/bin/sh' are working login shells for user '%s'. Your session may not function properly. ",shell,user);
> +      switch(pid=fork()) {
> + 	 case 0:
> +	    execl("/bin/sh", "/bin/sh", "-c", buf, NULL);
> +	 break;
> +       case -1:
> +	  return;
> +       default:
> +	  wait(&status);
> +	  break;
> +      }
> +   }
> +
> +   /* Damn, that didn't work either.
> +    * Bye! We call it quits and log an error */
> +   if (WEXITSTATUS(status)==2) {
> +      syslog(LOG_CRIT, "Entrance could not find a working shell to start the session for user: \"%s\".",user);
> +   }
> +}
> 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	30 Aug 2006 08:44:28 -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
>