Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 209792 - sys-block/vblade: /etc/init.d/vblade.vblade0 script doesn't stop vblades (egrep parsing error)
Summary: sys-block/vblade: /etc/init.d/vblade.vblade0 script doesn't stop vblades (egr...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-12 09:15 UTC by Adrian Goins
Modified: 2008-07-05 09:53 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to /etc/init.d/vblade.vblade0_0 (vblade0_0.init.patch,620 bytes, patch)
2008-02-12 09:22 UTC, Adrian Goins
Details | Diff
(corrected) patch for /etc/init.d/vblade0_0 (vblade0_0.init.patch,611 bytes, patch)
2008-02-13 06:43 UTC, Adrian Goins
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Goins 2008-02-12 09:15:11 UTC
the init script was changed as a result of 137016 to do some egrep parsing to find the vblade pid and stop it.  this syntax looks like the following:

ps -Ao pid,args | egrep "^[[:space:]]*[[:digit:]]+ /usr/sbin/vbladed ${shelf} ${slot} ${netif} ${src}" | awk '{print $1}' | xargs kill

this syntax fails because the actual process looks like the following:

5602 /bin/sh /usr/sbin/vbladed 0 3 eth0 /dev/ar/gauntlet-root

the egrep is missing the following:

* /bin/sh
* /usr/sbin/vbladed (instead of /usr/sbin/vblade)

additionally, it gets the full string it's looking for from /etc/conf.d/vblade, which means that if /etc/conf.d/vblade is modified before the particular vblade in question is stopped, the process it's looking for is wrong.  for example, if i change /etc/conf.d/vblade to have 0,3 running on eth1 instead of eth0 and then try to stop vblade 0,3 it will look for the process with 'eth1' in the string instead of 'eth0'.  the process will not be stopped.



Reproducible: Always

Steps to Reproduce:
1. run /etc/init.d/vblade.vblade0_0 to stop a running vblade
2. run /etc/init.d/vblade.vblade0_0 to stop a running vblade after changing /etc/conf.d/vblade


Actual Results:  
the egrep fails and xargs isn't passed anything to kill, causing it to exit with errors.

Expected Results:  
it should have stopped the vblade.

the correct syntax for the egrep (tested valid on my system) is:

ps -Ao pid,args | egrep "^[[:space:]]*[[:digit:]]+ /bin/sh /usr/sbin/vbladed ${shelf} ${slot}" | awk '{ print $1 }' | xargs kill

this looks for the bare minimum unique information (shelf/slot) to stop the process, without looking at information that may have changed in the configuration file (interface, physical partition).
Comment 1 Adrian Goins 2008-02-12 09:22:09 UTC
Created attachment 143290 [details, diff]
patch to /etc/init.d/vblade.vblade0_0

this is a unified diff of my modified init script
Comment 2 Adrian Goins 2008-02-13 06:42:37 UTC
after further research yesterday i realized that my initial report wasn't 100% accurate.  the /bin/sh...vbladed line is actually controlled by the line that the original egrep text looks for, and my patch and modification to vbladed0_0 doesn't work properly.

the problem of the script getting its information from /etc/conf.d/vblade is still correct - if this file has changed then an existing vblade cannot be stopped.  i've changed the init script and have an updated patch that does work correctly.
Comment 3 Adrian Goins 2008-02-13 06:43:23 UTC
Created attachment 143395 [details, diff]
(corrected) patch for /etc/init.d/vblade0_0

updated patch that identifies the correct process for signalling
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2008-07-05 09:53:50 UTC
incvs.

please open a stabilization bug in 1 week if it works fine.