diff options
-rw-r--r-- | INSTALL | 4 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | doc/index.html | 8 | ||||
-rw-r--r-- | doc/mdevd.html | 28 | ||||
-rw-r--r-- | doc/upgrade.html | 12 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/mdevd/PARSING.txt | 105 | ||||
-rw-r--r-- | src/mdevd/mdevd.c | 86 |
8 files changed, 154 insertions, 98 deletions
@@ -6,7 +6,7 @@ Build Instructions - A Linux-based system with a standard C development environment - GNU make version 3.81 or later - - skalibs version 2.10.0.0 or later: https://skarnet.org/software/skalibs/ + - skalibs version 2.10.0.2 or later: https://skarnet.org/software/skalibs/ This software is Linux-specific. It will run on a Linux kernel, version 2.6.10 or later. @@ -85,7 +85,7 @@ linking against the static libc with --enable-static-libc. Be aware that the GNU libc behaves badly with static linking and produces huge executables, which is why it is not the default. Other libcs are better suited to static linking, for instance -musl: http://musl-libc.org/ +musl: https://musl-libc.org/ * Cross-compilation @@ -1,5 +1,12 @@ Changelog for mdevd. +In 0.1.4.0 +---------- + + - New +, - and & command prefixes accepted in mdev.conf, that run +their command interpreted by execlineb instead of /bin/sh. + + In 0.1.3.0 ---------- diff --git a/doc/index.html b/doc/index.html index 0f03ac9..d6ea237 100644 --- a/doc/index.html +++ b/doc/index.html @@ -98,9 +98,13 @@ and does not pull in any unnecessary code. </li> The Linux kernel must be 2.6.10 or later. </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.10.0.0 or later. It's a build-time requirement. It's also a run-time +2.10.0.2 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> + <li> Optionally: <a href="//skarnet.org/software/execline/">execline</a> +version 2.8.0.0 or later. It's a only a run-time requirement, and only +if your <tt>mdev.conf</tt> file contains <tt>+</tt>, <tt>-</tt> or +<tt>&</tt> command directives. </li> </ul> <h3> Licensing </h3> @@ -114,7 +118,7 @@ library. </li> <ul> <li> The current released version of mdevd is -<a href="mdevd-0.1.3.0.tar.gz">0.1.3.0</a>. </li> +<a href="mdevd-0.1.4.0.tar.gz">0.1.4.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/mdevd/">mdevd git repository</a>: diff --git a/doc/mdevd.html b/doc/mdevd.html index 3412253..58568cd 100644 --- a/doc/mdevd.html +++ b/doc/mdevd.html @@ -151,6 +151,34 @@ configuration where it can create device nodes as root or delete them, and does nothing else. </p> +<h3> execline command support </h3> + +<p> + In addition to the traditional shell command spawning via the <tt>@</tt>, +<tt>$</tt> and <tt>*</tt> directives, mdevd also supports spawning a command +with the +<a href="https://skarnet.org/software/execline/execlineb.html">execlineb</a> +launcher: +</p> + +<ul> + <li> <tt>+<em>cmd</em></tt> : spawns <tt>execlineb -Pc <em>cmd</em></tt> +when this line catches an event that has <tt>ACTION=add</tt>. This is the +equivalent of <tt>@<em>cmd</em></tt>. </li> + <li> <tt>-<em>cmd</em></tt> : spawns <tt>execlineb -Pc <em>cmd</em></tt> +when this line catches an event that has <tt>ACTION=remove</tt>. This is the +equivalent of <tt>$<em>cmd</em></tt>. </li> + <li> <tt>&<em>cmd</em></tt> : spawns <tt>execlineb -Pc <em>cmd</em></tt> +when this line catches an event no matter its action type. This is the +equivalent of <tt>*<em>cmd</em></tt>. </li> +</ul> + +<p> + Note that unlike <tt>/bin/sh</tt>, <tt>execlineb</tt> is spawned without an +absolute path, so in order for <tt>+</tt>, <tt>-</tt> and <tt>&</tt> to +work, the <tt>execlineb</tt> command must be available in mdevd's PATH. +</p> + <h2> Notes </h2> <ul> diff --git a/doc/upgrade.html b/doc/upgrade.html index 7775575..90fdac3 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,18 @@ <h1> What has changed in mdevd </h1> +<h2> in 0.1.4.0 </h2> + +<ul> + <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> +dependency bumped to 2.10.0.2. </li> + <li> New <tt>+</tt>, <tt>-</tt> and <tt>&</tt> command +directives supported in <tt>mdev.conf</tt>. These directives +spawn a command interpreted by the +<a href="https://skarnet.org/software/execline/execlineb.html">execlineb</a> +program launcher instead of <tt>/bin/sh</tt>. </li> +</ul> + <h2> in 0.1.3.0 </h2> <ul> diff --git a/package/info b/package/info index 1020df4..e68fc98 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=mdevd -version=0.1.3.0 +version=0.1.4.0 category=admin package_macro_name=MDEVD diff --git a/src/mdevd/PARSING.txt b/src/mdevd/PARSING.txt index 2d7fc61..8702d6a 100644 --- a/src/mdevd/PARSING.txt +++ b/src/mdevd/PARSING.txt @@ -30,106 +30,106 @@ ENDLINE | + Second pass: we need to fill the envmatches and scriptelems with values. The whole mdev.conf semantics must be encoded in here. -class | ` a b c d e f g h i j k l m n o p -st\ev | \0 space ; $ # - @ \n , = > : * ! 0-7 8-9 other +class | ` a b c d e f g h i j k l m n o p q r +st\ev | \0 space ; $ # - @ \n , = > : * ! 0-7 8-9 + & other -START | $ cont @ + m|d m|d m|d m|d m|d m|d m|d -00 | END START X ENV1 COMMENT MINUS TOMAJ START DEVNAME X X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME +START | $ cont @ + m|d m|d m|d m|d m|d m|d m|d m|d m|d +00 | END START X ENV1 COMMENT MINUS TOMAJ START DEVNAME X X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME COMMENT | + -01 | END COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT START COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT +01 | END COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT START COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT COMMENT -MINUS | $ @ m|d m|d m|d m|d m|d m|d m|d -02 | X X X ENV1 X X TOMAJ X DEVNAME X X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME +MINUS | $ @ m|d m|d m|d m|d m|d m|d m|d m|d m|d +02 | X X X ENV1 X X TOMAJ X DEVNAME X X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME -ENV1 | m|v m|v m|v m|v m|v m|v m|v m|v m|v m|v m|v -03 | X X X INVAR1 X INVAR1 INVAR1 X INVAR1 X INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 +ENV1 | m|v m|v m|v m|v m|v m|v m|v m|v m|v m|v m|v m|v m|v +03 | X X X INVAR1 X INVAR1 INVAR1 X INVAR1 X INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 | z -04 | X X X INVAR1 X INVAR1 INVAR1 X INVAR1 TOVAL1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 +04 | X X X INVAR1 X INVAR1 INVAR1 X INVAR1 TOVAL1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 INVAR1 -TOVAL1 | m m m m m m m m m m -05 | X X X X X INVAL1 INVAL1 X INVAL1 X INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 +TOVAL1 | m m m m m m m m m m m m +05 | X X X X X INVAL1 INVAL1 X INVAL1 X INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 | z|re$ -06 | X TOUSER X INVAL1 X INVAL1 INVAL1 X INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 +06 | X TOUSER X INVAL1 X INVAL1 INVAL1 X INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 INVAL1 TOMAJ | m m -07 | X X X X X X X X X X X X X X INMAJ INMAJ X +07 | X X X X X X X X X X X X X X INMAJ INMAJ X X X INMAJ | z|mj -08 | X X X X X X X X TOMIN X X X X X INMAJ INMAJ X +08 | X X X X X X X X TOMIN X X X X X INMAJ INMAJ X X X TOMIN | m m -09 | X X X X X X X X X X X X X X INMIL INMIL X +09 | X X X X X X X X X X X X X X INMIL INMIL X X X INMIL | z|ml|h z|ml -0a | X TOUSER X X X TOMIH X X X X X X X X INMIL INMIL X +0a | X TOUSER X X X TOMIH X X X X X X X X INMIL INMIL X X X TOMIH | m m -0b | X X X X X X X X X X X X X X INMIH INMIH X +0b | X X X X X X X X X X X X X X INMIH INMIH X X X INMIH | z|mh -0c | X TOUSER X X X X X X X X X X X X INMIH INMIH X +0c | X TOUSER X X X X X X X X X X X X INMIH INMIH X X X DEVNAME | z|re z|v -0d | X TOUSER X DEVNAME X DEVNAME DEVNAME X DEVNAME TORE X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME +0d | X TOUSER X DEVNAME X DEVNAME DEVNAME X DEVNAME TORE X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME -TORE | m m m m m m m m m m m m -0e | X X X INRE X INRE INRE X INRE INRE INRE INRE INRE INRE INRE INRE INRE +TORE | m m m m m m m m m m m m m m +0e | X X X INRE X INRE INRE X INRE INRE INRE INRE INRE INRE INRE INRE INRE INRE INRE INRE | z|re$ -0f | X X TODEV INRE X INRE INRE X INRE INRE INRE INRE INRE INRE INRE INRE INRE +0f | X X TODEV INRE X INRE INRE X INRE INRE INRE INRE INRE INRE INRE INRE INRE INRE INRE -TODEV | m m m m m m m m m m -10 | X X X LASTRE X DEVNAME DEVNAME X DEVNAME X X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME +TODEV | m m m m m m m m m m m m +10 | X X X LASTRE X DEVNAME DEVNAME X DEVNAME X X DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME DEVNAME LASTRE | z|re -11 | X TOUSER X LASTRE X LASTRE LASTRE X LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE +11 | X TOUSER X LASTRE X LASTRE LASTRE X LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE LASTRE -TOUSER | m m m m -12 | X TOUSER X X X INUSER X X X X X X X X INUSER INUSER INUSER +TOUSER | m m m m m m +12 | X TOUSER X X X INUSER X X X X X X X X INUSER INUSER INUSER INUSER INUSER INUSER | z|u -13 | X X X X X INUSER X X X X X TOGRP X X INUSER INUSER INUSER +13 | X X X X X INUSER X X X X X TOGRP X X INUSER INUSER INUSER INUSER INUSER -TOGRP | m m m m -14 | X X X X X INGRP X X X X X X X X INGRP INGRP INGRP +TOGRP | m m m m m m +14 | X X X X X INGRP X X X X X X X X INGRP INGRP INGRP INGRP INGRP INGRP | z|g -15 | X TOMODE X X X INGRP X X X X X X X X INGRP INGRP INGRP +15 | X TOMODE X X X INGRP X X X X X X X X INGRP INGRP INGRP INGRP INGRP TOMODE | m -16 | X TOMODE X X X X X X X X X X X X INMODE X X +16 | X TOMODE X X X X X X X X X X X X INMODE X X X X INMODE | z|M z|M|L|+ -17 | X TOPATH X X X X X START X X X X X X INMODE X X +17 | X TOPATH X X X X X START X X X X X X INMODE X X X X -TOPATH | L r L a L|+ = > r|a ! -18 | END TOPATH X CMD COMMENT X CMD START X PATH PATH X CMD TOCMD X X X +TOPATH | L r L r|E a L|+ = > r|a ! a|E r|a|E +18 | END TOPATH X CMD COMMENT CMD CMD START X PATH PATH X CMD TOCMD X X CMD CMD X -PATH | p p p p p p p p p -19 | X X X X X INPATH INPATH X INPATH INPATH X INPATH X INPATH INPATH INPATH INPATH +PATH | p p p p p p p p p p p +19 | X X X X X INPATH INPATH X INPATH INPATH X INPATH X INPATH INPATH INPATH INPATH INPATH INPATH INPATH | L z z|L z|L|+ -1a | END TOCMD X X COMMENT INPATH INPATH START INPATH INPATH X INPATH X INPATH INPATH INPATH INPATH +1a | END TOCMD X X COMMENT INPATH INPATH START INPATH INPATH X INPATH X INPATH INPATH INPATH INPATH INPATH INPATH -TOCMD | L r L a L|+ r|a -1b | END TOCMD X CMD COMMENT X CMD START X X X X CMD X X X X +TOCMD | L r L r|E a L|+ r|a a|E r|a|E +1b | END TOCMD X CMD COMMENT CMD CMD START X X X X CMD X X X CMD CMD X -CMD | c c c c c c c c c c c c c -1c | X INCMD X INCMD X INCMD INCMD X INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD +CMD | c c c c c c c c c c c c c c c +1c | X INCMD X INCMD X INCMD INCMD X INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD | L z|L|+ -1d | END INCMD INCMD INCMD INCMD INCMD INCMD START INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD +1d | END INCMD INCMD INCMD INCMD INCMD INCMD START INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD INCMD -st/ev | \0 space ; $ # - @ \n , = > : * ! 0-7 8-9 other -class | ` a b c d e f g h i j k l m n o p +st/ev | \0 space ; $ # - @ \n , = > : * ! 0-7 8-9 + & other +class | ` a b c d e f g h i j k l m n o p q r END = 1e, X = 1f States : 30+2. They fit exactly into 5 bits. - Actions: 25. + Actions: 26. 0x80000000 unused, to avoid having to explicitly write U everywhere 0x40000000 $: prepare an envmatch, the scriptelem is DEVMATCH_NOTHING @@ -149,21 +149,21 @@ END = 1e, X = 1f 0x00010000 g: compute gid 0x00008000 M: compute mode 0x00004000 L: finalize/accept scriptelem, move to next one - 0x00002000 r: elem->cmdtype |= ACTION_REMOVE - 0x00001000 a: elem->cmdtype |= ACTION_ADD + 0x00002000 r: elem->cmdtype |= ACTION_REMOVE, interpreter=sh + 0x00001000 a: elem->cmdtype |= ACTION_ADD, interpreter=sh 0x00000800 =: elem->movetype = MOVEINFO_MOVE 0x00000400 >: elem->movetype = MOVEINFO_MOVEANDLINK 0x00000200 !: elem->movetype = MOVEINFO_NOCREATE 0x00000100 p: set movepath 0x00000080 c: set command 0x00000040 +: line++ - 0x00000020 unused. + 0x00000020 E: interpreter=execlineb Actions + states fit in a uint32_t. To debug script_secondpass: at the start of the loop, add - LOLDEBUG("state: %02x char: %c newstate: %02x actions: %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", state, s[pos] == '\n' ? '\\' : s[pos], what & 0x1f, + LOLDEBUG("state: %02x char: %c newstate: %02x actions: %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", state, s[pos] == '\n' ? '\\' : s[pos], what & 0x1f, what & 0x40000000 ? "$ " : "", what & 0x20000000 ? "@ " : "", what & 0x10000000 ? "d " : "", @@ -188,5 +188,6 @@ END = 1e, X = 1f what & 0x00000200 ? "! " : "", what & 0x00000100 ? "p " : "", what & 0x00000080 ? "c " : "", - what & 0x00000040 ? "+ " : "") ; + what & 0x00000040 ? "+ " : "", + what & 0x00000020 ? "E " : "") ; diff --git a/src/mdevd/mdevd.c b/src/mdevd/mdevd.c index f77fa60..ba65fe8 100644 --- a/src/mdevd/mdevd.c +++ b/src/mdevd/mdevd.c @@ -107,6 +107,7 @@ struct scriptelem_s unsigned int movetype : 2 ; unsigned int cmdtype : 2 ; unsigned int flagcont : 1 ; + unsigned int flagexecline : 1 ; unsigned short envmatchs ; } ; @@ -121,7 +122,9 @@ static scriptelem const scriptelem_catchall = .devmatchtype = DEVMATCH_CATCHALL, .movetype = MOVEINFO_NOTHING, .cmdtype = ACTION_NONE, - .flagcont = 0 + .flagcont = 0, + .flagexecline = 0, + .envmatchs = 0 } ; struct uevent_s @@ -339,44 +342,44 @@ static inline void script_firstpass (char *s, unsigned short *scriptlen, unsigne static inline unsigned char secondpass_cclass (char c) { - static unsigned char const classtable[65] = "`ppppppppagppappppppppppppppppppampdcppppplpheppnnnnnnnnookbpijpf" ; - return (unsigned char)c < 65 ? classtable[(unsigned char)c] - '`' : 16 ; + static unsigned char const classtable[65] = "`rrrrrrrragrrarrrrrrrrrrrrrrrrrramrdcrqrrrlpherrnnnnnnnnookbrijrf" ; + return (unsigned char)c < 65 ? classtable[(unsigned char)c] - '`' : 18 ; } static inline void script_secondpass (char *s, scriptelem *script, struct envmatch_s *envmatch) { - static uint32_t const table[30][17] = + static uint32_t const table[30][19] = { - { 0x0000001e, 0x00000000, 0x0000001f, 0x40000003, 0x00000001, 0x08000002, 0x20000007, 0x00000040, 0x1400000d, 0x0000001f, 0x0000001f, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d }, - { 0x0000001e, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000040, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x40000003, 0x0000001f, 0x0000001f, 0x20000007, 0x0000001f, 0x1400000d, 0x0000001f, 0x0000001f, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x04040004, 0x0000001f, 0x04040004, 0x04040004, 0x0000001f, 0x04040004, 0x0000001f, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004 }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x00000004, 0x0000001f, 0x00000004, 0x00000004, 0x0000001f, 0x00000004, 0x02000005, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000006, 0x04000006, 0x0000001f, 0x04000006, 0x0000001f, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006 }, - { 0x0000001f, 0x03000012, 0x0000001f, 0x00000006, 0x0000001f, 0x00000006, 0x00000006, 0x0000001f, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006 }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000008, 0x04000008, 0x0000001f }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x02800009, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000008, 0x00000008, 0x0000001f }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0400000a, 0x0400000a, 0x0000001f }, - { 0x0000001f, 0x02600012, 0x0000001f, 0x0000001f, 0x0000001f, 0x0240000b, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000000a, 0x0000000a, 0x0000001f }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0400000c, 0x0400000c, 0x0000001f }, - { 0x0000001f, 0x02100012, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000000c, 0x0000000c, 0x0000001f }, - { 0x0000001f, 0x02080012, 0x0000001f, 0x0000000d, 0x0000001f, 0x0000000d, 0x0000000d, 0x0000001f, 0x0000000d, 0x0204000e, 0x0000001f, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0400000f, 0x0000001f, 0x0400000f, 0x0400000f, 0x0000001f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f }, - { 0x0000001f, 0x0000001f, 0x03000010, 0x0000000f, 0x0000001f, 0x0000000f, 0x0000000f, 0x0000001f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x04000011, 0x0000001f, 0x0400000d, 0x0400000d, 0x0000001f, 0x0400000d, 0x0000001f, 0x0000001f, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d }, - { 0x0000001f, 0x02080012, 0x0000001f, 0x00000011, 0x0000001f, 0x00000011, 0x00000011, 0x0000001f, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011 }, - { 0x0000001f, 0x00000012, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000013, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000013, 0x04000013, 0x04000013 }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000013, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x02020014, 0x0000001f, 0x0000001f, 0x00000013, 0x00000013, 0x00000013 }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000015, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000015, 0x04000015, 0x04000015 }, - { 0x0000001f, 0x02010016, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000015, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000015, 0x00000015, 0x00000015 }, - { 0x0000001f, 0x00000016, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000017, 0x0000001f, 0x0000001f }, - { 0x0000001f, 0x02008018, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0200c040, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000017, 0x0000001f, 0x0000001f }, - { 0x0000401e, 0x00000018, 0x0000001f, 0x0000201c, 0x00004001, 0x0000001f, 0x0000101c, 0x00004040, 0x0000001f, 0x00000819, 0x00000419, 0x0000001f, 0x0000301c, 0x0000021b, 0x0000001f, 0x0000001f, 0x0000001f }, - { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000011a, 0x0000011a, 0x0000001f, 0x0000011a, 0x0000011a, 0x0000001f, 0x0000011a, 0x0000001f, 0x0000011a, 0x0000011a, 0x0000011a, 0x0000011a }, - { 0x0000401e, 0x0200001b, 0x0000001f, 0x0000001f, 0x02004001, 0x0000001a, 0x0000001a, 0x02004040, 0x0000001a, 0x0000001a, 0x0000001f, 0x0000001a, 0x0000001f, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a }, - { 0x0000401e, 0x0000001b, 0x0000001f, 0x0000201c, 0x00004001, 0x0000001f, 0x0000101c, 0x00004040, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000301c, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f }, - { 0x0000001f, 0x0000009d, 0x0000001f, 0x0000009d, 0x0000001f, 0x0000009d, 0x0000009d, 0x0000001f, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d }, - { 0x0000401e, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x02004040, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d } + { 0x0000001e, 0x00000000, 0x0000001f, 0x40000003, 0x00000001, 0x08000002, 0x20000007, 0x00000040, 0x1400000d, 0x0000001f, 0x0000001f, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d }, + { 0x0000001e, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000040, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x40000003, 0x0000001f, 0x0000001f, 0x20000007, 0x0000001f, 0x1400000d, 0x0000001f, 0x0000001f, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d, 0x1400000d }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x04040004, 0x0000001f, 0x04040004, 0x04040004, 0x0000001f, 0x04040004, 0x0000001f, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004, 0x04040004 }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x00000004, 0x0000001f, 0x00000004, 0x00000004, 0x0000001f, 0x00000004, 0x02000005, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000006, 0x04000006, 0x0000001f, 0x04000006, 0x0000001f, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006, 0x04000006 }, + { 0x0000001f, 0x03000012, 0x0000001f, 0x00000006, 0x0000001f, 0x00000006, 0x00000006, 0x0000001f, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00000006 }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000008, 0x04000008, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x02800009, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000008, 0x00000008, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0400000a, 0x0400000a, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x02600012, 0x0000001f, 0x0000001f, 0x0000001f, 0x0240000b, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000000a, 0x0000000a, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0400000c, 0x0400000c, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x02100012, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000000c, 0x0000000c, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x02080012, 0x0000001f, 0x0000000d, 0x0000001f, 0x0000000d, 0x0000000d, 0x0000001f, 0x0000000d, 0x0204000e, 0x0000001f, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d, 0x0000000d }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0400000f, 0x0000001f, 0x0400000f, 0x0400000f, 0x0000001f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f, 0x0400000f }, + { 0x0000001f, 0x0000001f, 0x03000010, 0x0000000f, 0x0000001f, 0x0000000f, 0x0000000f, 0x0000001f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x04000011, 0x0000001f, 0x0400000d, 0x0400000d, 0x0000001f, 0x0400000d, 0x0000001f, 0x0000001f, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d, 0x0400000d }, + { 0x0000001f, 0x02080012, 0x0000001f, 0x00000011, 0x0000001f, 0x00000011, 0x00000011, 0x0000001f, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011, 0x00000011 }, + { 0x0000001f, 0x00000012, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000013, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000013, 0x04000013, 0x04000013, 0x04000013, 0x04000013 }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000013, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x02020014, 0x0000001f, 0x0000001f, 0x00000013, 0x00000013, 0x00000013, 0x00000013, 0x00000013 }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000015, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000015, 0x04000015, 0x04000015, 0x04000015, 0x04000015 }, + { 0x0000001f, 0x02010016, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000015, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 }, + { 0x0000001f, 0x00000016, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x04000017, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000001f, 0x02008018, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0200c040, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x00000017, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f }, + { 0x0000401e, 0x00000018, 0x0000001f, 0x0000201c, 0x00004001, 0x0000203c, 0x0000101c, 0x00004040, 0x0000001f, 0x00000819, 0x00000419, 0x0000001f, 0x0000301c, 0x0000021b, 0x0000001f, 0x0000001f, 0x0000103c, 0x0000303c, 0x0000001f }, + { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000011a, 0x0000011a, 0x0000001f, 0x0000011a, 0x0000011a, 0x0000001f, 0x0000011a, 0x0000001f, 0x0000011a, 0x0000011a, 0x0000011a, 0x0000011a, 0x0000011a, 0x0000011a }, + { 0x0000401e, 0x0200001b, 0x0000001f, 0x0000001f, 0x02004001, 0x0000001a, 0x0000001a, 0x02004040, 0x0000001a, 0x0000001a, 0x0000001f, 0x0000001a, 0x0000001f, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a }, + { 0x0000401e, 0x0000001b, 0x0000001f, 0x0000201c, 0x00004001, 0x0000203c, 0x0000101c, 0x00004040, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000301c, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000103c, 0x0000303c, 0x0000001f }, + { 0x0000001f, 0x0000009d, 0x0000001f, 0x0000009d, 0x0000001f, 0x0000009d, 0x0000009d, 0x0000001f, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d, 0x0000009d }, + { 0x0000401e, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x02004040, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d, 0x0000001d } } ; size_t mark = 0 ; size_t col0 = 0 ; @@ -491,13 +494,14 @@ static inline void script_secondpass (char *s, scriptelem *script, struct envmat } script[i].mode = m ; } - if (what & 0x00002000) script[i].cmdtype |= ACTION_REMOVE ; - if (what & 0x00001000) script[i].cmdtype |= ACTION_ADD ; + if (what & 0x00002000) { script[i].cmdtype |= ACTION_REMOVE ; script[i].flagexecline = 0 ; } + if (what & 0x00001000) { script[i].cmdtype |= ACTION_ADD ; script[i].flagexecline = 0 ; } if (what & 0x00000800) script[i].movetype = MOVEINFO_MOVE ; if (what & 0x00000400) script[i].movetype = MOVEINFO_MOVEANDLINK ; if (what & 0x00000200) script[i].movetype = MOVEINFO_NOCREATE ; if (what & 0x00000100) script[i].movepath = pos ; if (what & 0x00000080) script[i].command = pos ; + if (what & 0x00000020) script[i].flagexecline = 1 ; if (what & 0x00000040) { line++ ; col0 = pos ; } if (what & 0x00004000) i++ ; pos++ ; @@ -655,9 +659,9 @@ static inline ssize_t alias_format (char *out, size_t outmax, char const *in, ch return w ; } -static inline void spawn_command (char const *command, struct uevent_s const *event) +static inline void spawn_command (char const *command, struct uevent_s const *event, int isel) { - char const *argv[4] = { "/bin/sh", "-c", command, 0 } ; + char const *argv[4] = { isel ? "execlineb" : "/bin/sh", isel ? "-Pc" : "-c", command, 0 } ; size_t envlen = env_len((char const **)environ) ; char const *envp[envlen + event->varn + 1] ; if (!env_merge(envp, envlen + event->varn + 1, (char const **)environ, envlen, event->buf + event->vars[1], event->len - event->vars[1])) @@ -668,7 +672,7 @@ static inline void spawn_command (char const *command, struct uevent_s const *ev pid = child_spawn0(argv[0], argv, envp) ; if (!pid) { - if (verbosity) strerr_warnwu1sys("spawn command") ; + if (verbosity) strerr_warnwu2sys("spawn ", argv[0]) ; } } @@ -817,7 +821,7 @@ static inline int run_scriptelem (struct uevent_s *event, scriptelem const *elem } if (dryrun) { - strerr_warni2x("dry run: spawn ", storage + elem->command) ; + strerr_warni4x("dry run: spawn ", elem->flagexecline ? "execlineb" : "/bin/sh", " for: ", storage + elem->command) ; if (verbosity >= 2) { char buf[UEVENT_MAX_SIZE + PATH_MAX + 5] ; @@ -834,7 +838,7 @@ static inline int run_scriptelem (struct uevent_s *event, scriptelem const *elem strerr_warni2x("dry run: added variables: ", buf) ; } } - else spawn_command(storage + elem->command, event) ; + else spawn_command(storage + elem->command, event, elem->flagexecline) ; } if (elem->movetype != MOVEINFO_NOCREATE && action == ACTION_REMOVE && mmaj >= 0) |