> > diff -Nru execline-2.5.0.1/debian/patches/move-execlineb-to-usr.patch 
> > execline-2.5.0.1/debian/patches/move-execlineb-to-usr.patch
> > --- execline-2.5.0.1/debian/patches/move-execlineb-to-usr.patch 1970-01-01 
> > 00:00:00.000000000 +0000
> > +++ execline-2.5.0.1/debian/patches/move-execlineb-to-usr.patch 2019-03-06 
> > 17:53:53.000000000 +0000
> > @@ -0,0 +1,48 @@
> > +--- a/src/execline/execlineb.c
> > ++++ b/src/execline/execlineb.c
> > +@@ -12,6 +12,7 @@
> > + #include <skalibs/djbunix.h>
> > + #include <skalibs/skamisc.h>
> > + #include <execline/execline.h>
> > ++#include <stdlib.h>
> > + #include "exlsn.h"
> > +
> > + #define USAGE "execlineb [ -p | -P | -S nmin | -s nmin ] [ -q | -w | -W ] 
> > [ -c commandline ] script args"
> > +@@ -64,6 +65,27 @@ static int myexlp (stralloc *sa, char co
> > +   return -1 ;
> > + }
> > +
> > ++/* Add /usr/lib/execline/bin into PATH. See #922642. */
> > ++static int adjust_path(const char *const *envp, stralloc *modif)
> > ++{
> > ++  size_t oldlen = modif->len;
> > ++  const char *old = env_get2(envp, "PATH");
> > ++  stralloc new = STRALLOC_ZERO;
> > ++
> > ++  if (!old) return 1 ;
> > ++
> > ++  if (!stralloc_cats(&new, "/usr/lib/execline/bin:")
> > ++   || !stralloc_cats(&new, old)
> > ++   || !env_addmodif(modif, "PATH", new.s)
> > ++   || setenv("PATH", new.s, 1) == -1)
> > ++  {
> > ++    stralloc_free(&new);
> > ++    modif->len = oldlen;
> > ++    return 0;
> > ++  }
> > ++  return 1;
> > ++}
> > ++
> > + int main (int argc, char const *const *argv, char const *const *envp)
> > + {
> > +   stralloc sa = STRALLOC_ZERO ;
> > +@@ -133,6 +155,9 @@ int main (int argc, char const *const *a
> > +       goto errenv ;
> > +   }
> > +
> > ++  if (!adjust_path(envp, &modif))
> > ++    goto errenv ;
> > ++
> > +   if (flagpushenv == 3 || flagpushenv == 4)
> > +   {
> > +     if (flagstrict && ((unsigned int)argc < nmin))


This C patch works for me. But I have another approach now.

Add following script as /usr/bin/execlineb

#!/usr/lib/execline/bin/execlineb -S0
/usr/lib/execline/bin/importas -D
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH PATH
/usr/lib/execline/bin/export PATH /usr/lib/execline/bin:${PATH}
/usr/lib/execline/bin/exec -a $0 /usr/lib/execline/bin/execlineb $@

What do you think?

-- 
Shengjing Zhu

Reply via email to