First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 211167
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo's Team for Core System packages <base-system@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: RonnyPeine@gmx.de
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
raid-start.sh-2.6.3-r4 raid-start.sh-2.6.3-r4 text/plain SpanKY 2008-02-24 19:10 0000 1.44 KB Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 211167 depends on: Show dependency tree
Bug 211167 blocks:
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-02-23 11:47 0000
sys-fs/mdadm-2.6.4 creates the directory /dev/dev, which i have found by
accident because rkhunter barks about it. In this directory it has created an
md0 block-device-file which is also created in /dev/md (the correct place for
this). I have a software raid so this is expected but not the entry in
/dev/dev. This is a regression compared to sys-fs/mdadm-2.6.2 which doesn't
create /dev/dev.

Reproducible: Always

------- Comment #1 From SpanKY 2008-02-23 20:50:08 0000 -------
works fine on my server

you'll need to trace the code and find out who is creating it ... look at the
addon in /lib/rcscripts/addons/raid-start.sh

also, post your mdadm.conf file as an attachment

------- Comment #2 From RonnyPeine@gmx.de 2008-02-24 11:15:41 0000 -------
(In reply to comment #1)
> works fine on my server
> 
> you'll need to trace the code and find out who is creating it ... look at the
> addon in /lib/rcscripts/addons/raid-start.sh
> 
> also, post your mdadm.conf file as an attachment
> 

Hello SpanKY,

i have found the bug. Here is the trace:
+ '[' -f /proc/mdstat ']'
+ MAJOR=9
+ mdadm_conf=/etc/mdadm/mdadm.conf
+ '[' -e /etc/mdadm.conf ']'
+ mdadm_conf=/etc/mdadm.conf
+ '[' -x /sbin/mdadm -a -f /etc/mdadm.conf ']'
++ awk '/^[[:space:]]*ARRAY/ { print $2 }' /etc/mdadm.conf
+ devs=/dev/md0
+ '[' -n /dev/md0 ']'
+ create_devs /dev/md0
+ local node dir minor
+ for node in '$@'
+ '[' /md0 '!=' /dev/md0 ']'
+ node=/dev//dev/md0
+ '[' -e /dev//dev/md0 ']'
+ dir=/dev//dev
+ '[' '!' -d /dev//dev ']'
+ mkdir -p /dev//dev
+ minor=md0
+ mknod /dev//dev/md0 b 9 0
+ ebegin 'Starting up RAID devices (mdadm)'
/lib/rcscripts/addons/raid-start-real.sh: line 34: ebegin: command not found
++ mdadm -As
+ output='mdadm: /dev/md0 has been started with 2 drives.'
+ ret=0
+ '[' 0 -ne 0 ']'
+ eend 0
/lib/rcscripts/addons/raid-start-real.sh: line 38: eend: command not found
++ ls '/dev/md_d*'
+ partitioned_devs=
+ '[' -n '' ']'

The problem lies in the line
[ "${node#/dev}" != "${node}" ] && node="/dev/${node}"
in create_devs().
It evaluates for node="/dev/md0" which is the value in my mdadm.conf for the
raiddevice to node="/dev//dev/md0".
It should not be "!=", it should be "=". Tested here and works fine.
I think the line should test if the node already inhibits the /dev, if not it
should put it as prefix in it. I'm wondering why you can't reproduce it. Maybe
you haven't rebooted since the update or you are using just "md0" in mdadm.conf
as devicename.
For tracing i have renamed raid-start.sh to raid-start-real.sh and written a
wrapper raid-start.sh which invokes raid-start-real.sh with bash -x, therefor
the ebegin error.

------- Comment #3 From SpanKY 2008-02-24 11:27:48 0000 -------
looks like robbat2 broke it ... i was testing the last version i wrote, and it
works fine ;)

------- Comment #4 From SpanKY 2008-02-24 19:10:05 0000 -------
Created an attachment (id=144526) [edit]
raid-start.sh-2.6.3-r4

please test this for me

------- Comment #5 From RonnyPeine@gmx.de 2008-02-25 20:36:28 0000 -------
(In reply to comment #4)
> Created an attachment (id=144526) [edit]
> raid-start.sh-2.6.3-r4
> 
> please test this for me
> 

Well, i have just read your script and your quoting seems to be not so well.
The quotes are better in robbat2's script, he uses '"' with care where it
should be. I prefer robbat2's script with just my small "="-fix.
Be careful with using "" in a for loop like 'for node in "$@"'. This works for
this variable but can be wrong in other ways like FOO="a b c d"; for i in
"${FOO}"; do echo $i; done. It's better to omit these '"' in most cases.
The other quotes are better solved in robbat2's which would also allow spaces
and things like that in devicenames even if this won't ever occur.

------- Comment #6 From SpanKY 2008-02-25 22:12:41 0000 -------
are you saying that without testing/knowing for real ?  i removed quotes where
they were not actually needed

if you know of a specific place where quotes are missing, state them now

you also dont know the difference between "$@" and "$*".  mine is correct,
robbat2's is not.  consult the bash man page.

------- Comment #7 From RonnyPeine@gmx.de 2008-02-26 07:04:01 0000 -------
(In reply to comment #6)
> are you saying that without testing/knowing for real ?  i removed quotes where
> they were not actually needed
> 
> if you know of a specific place where quotes are missing, state them now
> 
> you also dont know the difference between "$@" and "$*".  mine is correct,
> robbat2's is not.  consult the bash man page.
> 

Ok, you are right with the "$@" as stated before, but i like more to quote with
'"' for variable initialization like devs="$(awk '/^[[:space:]]*ARRAY/ { print
$2 }' ${mdadm_conf})" instead of omitting '"' here, it's more about taste here.
Your script will work, i don't need to test it. Changes are minor and mostly
only quoting.

------- Comment #8 From SpanKY 2008-02-26 07:17:07 0000 -------
pointless quoting around assignments like:
var="$(command)"
leads to ugliness when you need to quote inside of the $(...):
var="$(command "${arg}")"

added to 2.6.4-r1

------- Comment #9 From RonnyPeine@gmx.de 2008-02-26 19:13:33 0000 -------
(In reply to comment #8)
> pointless quoting around assignments like:
> var="$(command)"
> leads to ugliness when you need to quote inside of the $(...):
> var="$(command "${arg}")"
> 
> added to 2.6.4-r1
> 

Let's summarize it as different tastes :) Your script works, maybe inclusion in
a sys-fs/mdadm-2.6.4-r1 possible?

------- Comment #10 From RonnyPeine@gmx.de 2008-02-26 19:14:19 0000 -------
(In reply to comment #9)
> (In reply to comment #8)
> > pointless quoting around assignments like:
> > var="$(command)"
> > leads to ugliness when you need to quote inside of the $(...):
> > var="$(command "${arg}")"
> > 
> > added to 2.6.4-r1
> > 
> 
> Let's summarize it as different tastes :) Your script works, maybe inclusion in
> a sys-fs/mdadm-2.6.4-r1 possible?
> 

Hmm i should have read your comment more deeply :)

First Last Prev Next    No search results available      Search page      Enter new bug