Re: CVS commit: src/usr.sbin/service

2015-03-31 Thread Alan Barrett

On Wed, 01 Apr 2015, Adrian Steinmann wrote:

Please could this be fixed to use shell quoting in a safe way.

OK, if that'll unstall the pullup-7.


I don't know.


Are you implying that the /etc/rc.d/ system supports space in filenames?


No, I am implying that somebody could create a file whose name 
contains a space.  Whether or not it's supported is separate from 
whether or not the service(8) script does strange things when it 
happens.


--apb (Alan Barrett)


Re: CVS commit: src/usr.sbin/service

2015-03-31 Thread Adrian Steinmann
> Please could this be fixed to use shell quoting in a safe way.
OK, if that'll unstall the pullup-7.

Are you implying that the /etc/rc.d/ system supports space in filenames?

Adrian


Re: CVS commit: src/usr.sbin/service

2015-03-31 Thread Alan Barrett

On Fri, 27 Mar 2015, Adrian Steinmann wrote:

Modified Files:
src/usr.sbin/service: service


Please could this be fixed to use shell quoting in a safe way.

For example ...


+_rc_files()
{
-local dir
-for dir in ${rc_directories}; do
-[ -d ${dir} ] && ls -P1 ${dir} 2>/dev/null
+local _d _f
+for _d in ${rc_directories}; do
+if [ -d $_d ]; then
+for _f in $_d/*; do [ -f $_f -a -x $_f ] && echo $_f; done
+fi


should be ...

 if [ -d "$_d" ]; then
 for _f in "$_d"/*; do
 [ -f "$_f" -a -x "$_f" ] && echo "$_f"
  done
 fi

--apb (Alan Barrett)