Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
Bruce Dubbs wrote: > de...@hawaii.rr.com wrote: > >> Well, then something else is amiss. the statusproc() function defined here: >> http://www.linuxfromscratch.org/lfs/view/stable/scripts/apds02.html >> does not have the *) case. >> >> And neither does the one defined in >> lfs-bootscripts-20111017/lfs/lib/services/init-functions >> as downloaded just now from >> http://www.linuxfromscratch.org/lfs/downloads/7.0/lfs-bootscripts-20111017.tar.bz2 > > I now remember that I fixed that on Nov 14 in svn. I guess it didn't > get into the errata. Try using the current -dev version: > > http://www.linuxfromscratch.org/lfs/downloads/development/lfs-bootscripts-20120116.tar.bz2 Aha. That did it. Many thanks. For the mailing list archives; Upgrading bootscripts from the 20111017 version to 20120116 requires devtmpfs support in the kernel. -dean takemori -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
de...@hawaii.rr.com wrote: > Well, then something else is amiss. the statusproc() function defined here: > http://www.linuxfromscratch.org/lfs/view/stable/scripts/apds02.html > does not have the *) case. > > And neither does the one defined in > lfs-bootscripts-20111017/lfs/lib/services/init-functions > as downloaded just now from > http://www.linuxfromscratch.org/lfs/downloads/7.0/lfs-bootscripts-20111017.tar.bz2 I now remember that I fixed that on Nov 14 in svn. I guess it didn't get into the errata. Try using the current -dev version: http://www.linuxfromscratch.org/lfs/downloads/development/lfs-bootscripts-20120116.tar.bz2 -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
>deant at hawaii.rr.com wrote: > >You are not giving the whole loop: > > while true; do >case "${1}" in > >-p) >pidfile="${2}" >shift 2 >;; > >*) >if [ -n "${2}" ]; then >echo "Too many arguments" >return 1 >else >break >fi >;; >esac >done > > >The 'break' command breaks out of the while loop. It's not the same as >C/C++. > >The 'functions' file is only present for a few (currently 19 are left) >bootscripts in BLFS that have not yet been updated to LFS 7.0 syntax. > > -- Bruce Well, then something else is amiss. the statusproc() function defined here: http://www.linuxfromscratch.org/lfs/view/stable/scripts/apds02.html does not have the *) case. And neither does the one defined in lfs-bootscripts-20111017/lfs/lib/services/init-functions as downloaded just now from http://www.linuxfromscratch.org/lfs/downloads/7.0/lfs-bootscripts-20111017.tar.bz2 -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
de...@hawaii.rr.com wrote: >>> while true; do >>> case "${1}" in >>> >>> -p) >>> pidfile="${2}" >>> shift 2 >>> ;; >>> esac >>> done > Unless I'm misreading and mis-testing it, there's no break out of > the loop; You are not giving the whole loop: while true; do case "${1}" in -p) pidfile="${2}" shift 2 ;; *) if [ -n "${2}" ]; then echo "Too many arguments" return 1 else break fi ;; esac done The 'break' command breaks out of the while loop. It's not the same as C/C++. The 'functions' file is only present for a few (currently 19 are left) bootscripts in BLFS that have not yet been updated to LFS 7.0 syntax. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
>Bruce Dubbs wrote: >>Dean Takemori wrote: >>lfs/lib/services/init-functions defines statusproc() with this snippit >>to process arguments: >> >>while true; do >> case "${1}" in >> >> -p) >> pidfile="${2}" >> shift 2 >> ;; >> esac >>done >> >> >>Isn't this broken? >> >>What's broken? Can you give an example of how it breaks? >> Unless I'm misreading and mis-testing it, there's no break out of the loop; For example, given this: root:/tmp/lfs-bootscripts-20111017# bash --version | head -1 GNU bash, version 4.2.10(2)-release (i686-pc-linux-gnu) root:/tmp/lfs-bootscripts-20111017# cat /run/fcron.pid 2066 root:/tmp/lfs-bootscripts-20111017# ps xa | grep 2066 2066 ?Ss 0:00 /usr/sbin/fcron 2333 tty1 S+ 0:00 grep 2066 And then doing this: root:/tmp/lfs-bootscripts-20111017# source lfs/lib/services/init-functions Both of these never return; root:/tmp/lfs-bootscripts-20111017# statusproc -p /run/fcron.pid /usr/sbin/fcron root:/tmp/lfs-bootscripts-20111017# statusproc /usr/sbin/fcron But if one does instead (after commenting out the init_params line as per the 7.0 errata) root:/tmp/lfs-bootscripts-20111017# source lfs/init.d/functions root:/tmp/lfs-bootscripts-20111017# statusproc -p /run/fcron.pid /usr/sbin/fcron fcron is running with Process ID(s) 2066. root:/tmp/lfs-bootscripts-20111017# statusproc /usr/sbin/fcron fcron is running with Process ID(s) 2066. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
DJ Lucas wrote: > On 01/22/2012 10:43 AM, Bruce Dubbs wrote: >> Dean Takemori wrote: >>> lfs/lib/services/init-functions defines statusproc() with this snippit >>> to process arguments: >>> >>>while true; do >>> case "${1}" in >>> >>> -p) >>> pidfile="${2}" >>> shift 2 >>> ;; >>> esac >>>done >>> >>> >>> Isn't this broken? >> What's broken? Can you give an example of how it breaks? > I think this might carry over from the original so the problem dates > back to me or possibly even Nathan and Alex. I didn't look. At any rate, > the problem is that there is no error checking. I don't believe that > statusproc() is intended to check multiple processes from multiple > executables (multiple processes from one executable yes). For the -p > case, you should verify that $2 is a valid file, and that $3 is > executable or undefined, and add a * case, that $1 is executable and $2 > = "-p" && shift 1;. If any of the above are false, a return value of 2 > should fit the LSB spec with optional error message "Error: invalid or > excessive argument(s)". A case could be made that $3 in the -p case or > $1 in the * case not being executable should return a value of 5, but > I'm not sure that value should apply here. I didn't look to see if the > executable is evaluated later in the function, but the function should > most definitely have argument handling for excessive arguments in the > while loop. > > http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html I still don't understand what is broken. In every place statusproc is called, it is from the user running '/etc/init.d/service status'. The maximum harm would be that the wrong thing is displayed, but only postfix and swat specify a -p parameter. Until we establish what is broken, I am not in favor of making any changes. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
On 01/22/2012 10:43 AM, Bruce Dubbs wrote: > Dean Takemori wrote: >> lfs/lib/services/init-functions defines statusproc() with this snippit >> to process arguments: >> >>while true; do >> case "${1}" in >> >> -p) >> pidfile="${2}" >> shift 2 >> ;; >> esac >>done >> >> >> Isn't this broken? > What's broken? Can you give an example of how it breaks? > > -- Bruce I think this might carry over from the original so the problem dates back to me or possibly even Nathan and Alex. I didn't look. At any rate, the problem is that there is no error checking. I don't believe that statusproc() is intended to check multiple processes from multiple executables (multiple processes from one executable yes). For the -p case, you should verify that $2 is a valid file, and that $3 is executable or undefined, and add a * case, that $1 is executable and $2 = "-p" && shift 1;. If any of the above are false, a return value of 2 should fit the LSB spec with optional error message "Error: invalid or excessive argument(s)". A case could be made that $3 in the -p case or $1 in the * case not being executable should return a value of 5, but I'm not sure that value should apply here. I didn't look to see if the executable is evaluated later in the function, but the function should most definitely have argument handling for excessive arguments in the while loop. http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html -- DJ Lucas -- This message has been scanned for viruses and dangerous content, and is believed to be clean. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
Re: [lfs-dev] bootscripts-20111017 statusproc() broken?
Dean Takemori wrote: > lfs/lib/services/init-functions defines statusproc() with this snippit > to process arguments: > > while true; do > case "${1}" in > > -p) > pidfile="${2}" > shift 2 > ;; > esac > done > > > Isn't this broken? What's broken? Can you give an example of how it breaks? -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
[lfs-dev] bootscripts-20111017 statusproc() broken?
lfs/lib/services/init-functions defines statusproc() with this snippit to process arguments: while true; do case "${1}" in -p) pidfile="${2}" shift 2 ;; esac done Isn't this broken? I notice that the statusproc() defined in the (deprecated) lfs/init.d/functions includes both an unknown option error message and a break out of the loop: while true; do case "${1}" in -p) pidfile="${2}" shift2 ;; -*) log_failure_msg "Unknown Option: ${1}" return 2 ;; *) break ;; esac done -dean takemori -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page