From 644ee05aabfb2f8b22fe774774b174180a66c951 Mon Sep 17 00:00:00 2001 From: Jesse Date: Tue, 15 Feb 2022 17:01:41 -0400 Subject: [PATCH] Update manual pages with markup and spacing fixes. Added ability to use "@" symbol in command named in the inittab file. This treats commands as literal and does not launch a shell to interpret them. Updated inittab manual page to include overview of symbols which trigger a shell interpretor and how to disable them using the @ symbol. --- doc/Changelog | 5 +++++ man/bootlogd.8 | 2 +- man/fstab-decode.8 | 2 +- man/halt.8 | 2 +- man/init.8 | 2 +- man/initctl.5 | 2 +- man/initscript.5 | 2 +- man/inittab.5 | 22 +++++++++++++++++++++- man/killall5.8 | 2 +- man/last.1 | 2 +- man/logsave.8 | 2 +- man/mesg.1 | 2 +- man/mountpoint.1 | 2 +- man/pidof.8 | 2 +- man/readbootlog.1 | 2 +- man/runlevel.8 | 2 +- man/shutdown.8 | 2 +- man/sulogin.8 | 2 +- man/utmpdump.1 | 2 +- man/wall.1 | 2 +- src/init.c | 7 +++++-- 21 files changed, 49 insertions(+), 21 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 0d57440..2b24c98 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,4 @@ +sysvinit (3.02) unreleased; urgency=low * Added q and Q flags to synopsis in shutdown manual page. * Applied fixes for markup and spacing in manual pages. Patch provided by Mario Blattermann. @@ -5,6 +6,10 @@ * Added Makefile for man/ directory. Will handle translations and substitutions. * Applied new translations for multiple languages from Mario Blattermann. + * Added ability to use "@" symbol in command named in the inittab file. This + treats commands as literal and does not launch a shell to interpret them. + * Updated inittab manual page to include overview of symbols which trigger + a shell interpretor and how to disable them using the @ symbol. sysvinit (3.01) released; urgency=low diff --git a/man/bootlogd.8 b/man/bootlogd.8 index 440fc62..de88370 100644 --- a/man/bootlogd.8 +++ b/man/bootlogd.8 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH BOOTLOGD 8 "Jul 21, 2003" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH BOOTLOGD 8 "Jul 21, 2003" "sysvinit " "Linux System Administrator's Manual" .SH NAME bootlogd \- record boot messages .SH SYNOPSIS diff --git a/man/fstab-decode.8 b/man/fstab-decode.8 index 6e1f7e7..b9fbf01 100644 --- a/man/fstab-decode.8 +++ b/man/fstab-decode.8 @@ -17,7 +17,7 @@ .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. .\" .\" Author: Miloslav Trmac -.TH FSTAB-DECODE 8 "May 2006" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH FSTAB-DECODE 8 "May 2006" "sysvinit " "Linux System Administrator's Manual" .SH NAME fstab-decode \- run a command with fstab-encoded arguments diff --git a/man/halt.8 b/man/halt.8 index b542ac4..b4e4b50 100644 --- a/man/halt.8 +++ b/man/halt.8 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH HALT 8 "Nov 6, 2001" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH HALT 8 "Nov 6, 2001" "sysvinit " "Linux System Administrator's Manual" .\"}}} .\"{{{ Name .SH NAME diff --git a/man/init.8 b/man/init.8 index 69ce4c6..7dfdd8f 100644 --- a/man/init.8 +++ b/man/init.8 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH INIT 8 "29 Jul 2004" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH INIT 8 "29 Jul 2004" "sysvinit " "Linux System Administrator's Manual" .\"}}} .\"{{{ Name .SH NAME diff --git a/man/initctl.5 b/man/initctl.5 index 388645d..21e0aa8 100644 --- a/man/initctl.5 +++ b/man/initctl.5 @@ -14,7 +14,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH INITCTL 5 "April 13, 2018" "sysvinit @VERSION@" "File Formats" +.TH INITCTL 5 "April 13, 2018" "sysvinit " "File Formats" .SH NAME initctl \- /run/initctl is a named pipe which passes commands to SysV init .SH SYNOPSIS diff --git a/man/initscript.5 b/man/initscript.5 index b979756..6d892a9 100644 --- a/man/initscript.5 +++ b/man/initscript.5 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH INITSCRIPT 5 "July 10, 2003" "sysvinit @VERSION@" "File Formats" +.TH INITSCRIPT 5 "July 10, 2003" "sysvinit " "File Formats" .SH NAME initscript \- script that executes inittab commands .SH SYNOPSIS diff --git a/man/inittab.5 b/man/inittab.5 index 726f894..d290ae8 100644 --- a/man/inittab.5 +++ b/man/inittab.5 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH INITTAB 5 "Dec 4, 2001" "sysvinit @VERSION@" "File Formats" +.TH INITTAB 5 "Dec 4, 2001" "sysvinit " "File Formats" .\"}}} .\"{{{ Name .SH NAME @@ -67,6 +67,26 @@ a `+' character, will not do utmp and wtmp accounting for that process. This is needed for gettys that insist on doing their own utmp/wtmp housekeeping. This is also a historic bug. The length of this field is limited to 127 characters. + +Please note that including certain characters in the process field will result +in +.B init +attempting to launch a shell to interpret the command contained in the process field. +The characters which will trigger a shell are: +.B ~`!$^&*()=|\{}[];\"'<>? + +On systems which do not have a shell to be launched or which do not wish to +use a shell to interpret the process field, the process field can be prefixed +with the @ symbol. The @ will be ignored and everything followed will be treated +as a command to be launched, literally, by the +.B init +service. + +In cases where both a + and @ sign are to be used (to turn off logging and shell +interpretation), place the + sign before the @ symbol. Both flags will be handled +and then everything following the @ will be handled by +.B init + .\"}}} .PP The \fIrunlevels\fP field may contain multiple characters for different diff --git a/man/killall5.8 b/man/killall5.8 index 35ee701..5d31f19 100644 --- a/man/killall5.8 +++ b/man/killall5.8 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH KILLALL5 8 "04 Nov 2003" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH KILLALL5 8 "04 Nov 2003" "sysvinit " "Linux System Administrator's Manual" .SH NAME killall5 - send a signal to all processes .SH SYNOPSIS diff --git a/man/last.1 b/man/last.1 index c54135c..8ec90d5 100644 --- a/man/last.1 +++ b/man/last.1 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH LAST, LASTB 1 "Jul 31, 2004" "sysvinit @VERSION@" "User Commands" +.TH LAST, LASTB 1 "Jul 31, 2004" "sysvinit " "User Commands" .\"}}} .\"{{{ Name .SH NAME diff --git a/man/logsave.8 b/man/logsave.8 index 1c4cdca..449a09a 100644 --- a/man/logsave.8 +++ b/man/logsave.8 @@ -2,7 +2,7 @@ .\" Copyright 2003 by Theodore Ts'o. All Rights Reserved. .\" This file may be copied under the terms of the GNU Public License. .\" -.TH LOGSAVE 8 "" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH LOGSAVE 8 "" "sysvinit " "Linux System Administrator's Manual" .SH NAME logsave \- save the output of a command in a logfile .SH SYNOPSIS diff --git a/man/mesg.1 b/man/mesg.1 index 50c6aa1..3f590e4 100644 --- a/man/mesg.1 +++ b/man/mesg.1 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH MESG 1 "Feb 26, 2001" "sysvinit @VERSION@" "User Commands" +.TH MESG 1 "Feb 26, 2001" "sysvinit " "User Commands" .\"}}} .\"{{{ Name .SH NAME diff --git a/man/mountpoint.1 b/man/mountpoint.1 index c74ef44..29587df 100644 --- a/man/mountpoint.1 +++ b/man/mountpoint.1 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH MOUNTPOINT 1 "Mar 15, 2004" "sysvinit @VERSION@" "User Commands" +.TH MOUNTPOINT 1 "Mar 15, 2004" "sysvinit " "User Commands" .SH NAME mountpoint \- see if a directory is a mountpoint .SH SYNOPSIS diff --git a/man/pidof.8 b/man/pidof.8 index 7c41824..6866cb3 100644 --- a/man/pidof.8 +++ b/man/pidof.8 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH PIDOF 8 "01 Sep 1998" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH PIDOF 8 "01 Sep 1998" "sysvinit " "Linux System Administrator's Manual" .SH NAME pidof - find the process ID of a running program .SH SYNOPSIS diff --git a/man/readbootlog.1 b/man/readbootlog.1 index 1cbf801..7c325fd 100644 --- a/man/readbootlog.1 +++ b/man/readbootlog.1 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH READBOOTLOG 1 "NOV 12, 2018" "sysvinit @VERSION@" "User Commands" +.TH READBOOTLOG 1 "NOV 12, 2018" "sysvinit " "User Commands" .\"}}} .\"{{{ Name .SH NAME diff --git a/man/runlevel.8 b/man/runlevel.8 index 811d81a..9252dc8 100644 --- a/man/runlevel.8 +++ b/man/runlevel.8 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH RUNLEVEL 8 "May 27, 1997" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH RUNLEVEL 8 "May 27, 1997" "sysvinit " "Linux System Administrator's Manual" .SH NAME runlevel - find the previous and current system runlevel .SH SYNOPSIS diff --git a/man/shutdown.8 b/man/shutdown.8 index 325b349..1869ae1 100644 --- a/man/shutdown.8 +++ b/man/shutdown.8 @@ -17,7 +17,7 @@ .\" .\"{{{}}} .\"{{{ Title -.TH SHUTDOWN 8 "November 12, 2003" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH SHUTDOWN 8 "November 12, 2003" "sysvinit " "Linux System Administrator's Manual" .\"}}} .\"{{{ Name .SH NAME diff --git a/man/sulogin.8 b/man/sulogin.8 index c16d97e..250059a 100644 --- a/man/sulogin.8 +++ b/man/sulogin.8 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH SULOGIN 8 "17 Jan 2006" "sysvinit @VERSION@" "Linux System Administrator's Manual" +.TH SULOGIN 8 "17 Jan 2006" "sysvinit " "Linux System Administrator's Manual" .SH NAME sulogin \- Single-user login .SH SYNOPSIS diff --git a/man/utmpdump.1 b/man/utmpdump.1 index a6a6dfb..05f9e7b 100644 --- a/man/utmpdump.1 +++ b/man/utmpdump.1 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH UTMPDUMP 1 "Februar 8, 2010" "sysvinit @VERSION@" "User Commands" +.TH UTMPDUMP 1 "Februar 8, 2010" "sysvinit " "User Commands" .SH NAME utmpdump \- dump UTMP and WTMP files in raw format .SH SYNOPSIS diff --git a/man/wall.1 b/man/wall.1 index 0ba3840..a59e944 100644 --- a/man/wall.1 +++ b/man/wall.1 @@ -15,7 +15,7 @@ .\" along with this program; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA .\" -.TH WALL 1 "15 April 2003" "sysvinit @VERSION@" "User Commands" +.TH WALL 1 "15 April 2003" "sysvinit " "User Commands" .SH NAME wall - send a message to everybody's terminal diff --git a/src/init.c b/src/init.c index 8614282..d8e304e 100644 --- a/src/init.c +++ b/src/init.c @@ -1097,10 +1097,12 @@ pid_t spawn(CHILD *ch, int *res) break; } } + if (proc[0] == '@') proc++; /*skip leading backslash */ args[6] = proc; args[7] = NULL; - } else if (strpbrk(proc, "~`!$^&*()=|\\{}[];\"'<>?")) { + } else if ( (strpbrk(proc, "~`!$^&*()=|\\{}[];\"'<>?")) && (proc[0] != '@') ){ /* See if we need to fire off a shell for this command */ + /* Do not launch shell if first character in proc string is an at symbol */ /* Give command line to shell */ args[1] = SHELL; args[2] = "-c"; @@ -1111,6 +1113,7 @@ pid_t spawn(CHILD *ch, int *res) } else { /* Split up command line arguments */ buf[0] = 0; + if (proc[0] == '@') proc++; strncat(buf, proc, sizeof(buf) - 1); ptr = buf; for(f = 1; f < 15; f++) { @@ -1312,7 +1315,7 @@ pid_t spawn(CHILD *ch, int *res) if (pid == -1) { initlog(L_VB, "cannot fork, retry.."); - do_msleep(SHORT_SLEEP); + do_msleep(SHORT_SLEEP); continue; } return(pid);