Re: Execlineb scripts on systems with conflicting binaries

2016-05-27 Thread Lorenzo

On 05/27/2016 01:04 PM, Laurent Bercot wrote:

On 27/05/2016 12:31, Remko Tronçon wrote:

Some of the 'built-in' binaries of execline conflict with binaries that
already exist on the system.


  As far as I'm aware of, it's only import. Are there other binaries that
conflict with other packages?

Here on debian, yes:
$ for i in $BIN_TARGETS ; do apt-file search bin/$i|grep "bin/$i\$"; done
graphicsmagick-imagemagick-compat: /usr/bin/import
$ apt-cache pkgnames|wc -l
52105

That's not really 52k packages, since debian splits packages (eg, foo, 
foo-dev, foo-doc; xmms2-plugin-* alone is 46 packages), but it's still a 
reasonable sample :)


argc in s6 vs daemontools

2015-03-17 Thread Lorenzo

Hi everyone,

there's a few commands that take N arguments in daemontools and only one 
in s6 - which is a perfectly fine choice, except that most of them 
(think svstat *) will reject no arguments and accept N arguments, but 
only using the 1st one.


These commands are:
- svc
- supervise,svok,svscan? (do the same in the original, so ok)
- svstat
- svscanctl (not in the original)

Here's a boring patch that rejects unused arguments (except for svscan).

---
 src/supervision/s6-supervise.c | 2 +-
 src/supervision/s6-svc.c   | 2 +-
 src/supervision/s6-svok.c  | 2 +-
 src/supervision/s6-svscanctl.c | 2 +-
 src/supervision/s6-svstat.c| 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index 4aaf371..02cdd21 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -430,7 +430,7 @@ int main (int argc, char const *const *argv)
 {
   iopause_fd x[2] = { { -1, IOPAUSE_READ, 0 }, { -1, IOPAUSE_READ, 0 } } ;
   PROG = s6-supervise ;
-  if (argc  2) strerr_dieusage(100, USAGE) ;
+  if (argc != 2) strerr_dieusage(100, USAGE) ;
   if (chdir(argv[1])  0) strerr_diefu2sys(111, chdir to , argv[1]) ;
   {
 register unsigned int proglen = str_len(PROG) ;
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index e9396de..1433f79 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -57,7 +57,7 @@ int main (int argc, char const *const *argv, char 
const *const *envp)

 }
 argc -= l.ind ; argv += l.ind ;
   }
-  if (!argc) dieusage() ;
+  if (argc != 1) dieusage() ;
   if (updown[1])
   {
 char const *newargv[11] ;
diff --git a/src/supervision/s6-svok.c b/src/supervision/s6-svok.c
index 4a615e9..7fbe061 100644
--- a/src/supervision/s6-svok.c
+++ b/src/supervision/s6-svok.c
@@ -11,7 +11,7 @@
 int main (int argc, char const *const *argv)
 {
   PROG = s6-svok ;
-  if (argc  2) strerr_dieusage(100, USAGE) ;
+  if (argc != 2) strerr_dieusage(100, USAGE) ;
   argv++ ; argc-- ;
   {
 int fd ;
diff --git a/src/supervision/s6-svscanctl.c b/src/supervision/s6-svscanctl.c
index 6529e9c..13cee5e 100644
--- a/src/supervision/s6-svscanctl.c
+++ b/src/supervision/s6-svscanctl.c
@@ -50,7 +50,7 @@ int main (int argc, char const *const *argv)
 }
 argc -= l.ind ; argv += l.ind ;
   }
-  if (!argc) dieusage() ;
+  if (argc != 1) dieusage() ;

   {
 unsigned int arglen = str_len(*argv) ;
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c
index de8fe0d..b67a2fe 100644
--- a/src/supervision/s6-svstat.c
+++ b/src/supervision/s6-svstat.c
@@ -40,7 +40,7 @@ int main (int argc, char const *const *argv)
 }
 argc -= l.ind ; argv += l.ind ;
   }
-  if (!argc) dieusage() ;
+  if (argc != 1) dieusage() ;

   if (!s6_svstatus_read(*argv, status))
 strerr_diefu2sys(111, read status for , *argv) ;
--
2.1.4