Bug#864181: Fwd: Bug#864181: os-prober: dmraid detection not functional.

2017-06-08 Thread Philip Hands
Mike Mestnik  writes:

> In that case the proposed patch is wrong, dmraid is run every time the
> file exists.  Not only is the conditional in test wrong, but the file
> is created when it should be being removed.

You appear to be reading the || after the -f test as &&

To render those lines into english, one would have:

  Either the file exists OR
 we create it now

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,GERMANY


signature.asc
Description: PGP signature


Bug#864181: Fwd: Bug#864181: os-prober: dmraid detection not functional.

2017-06-07 Thread Mike Mestnik
In that case the proposed patch is wrong, dmraid is run every time the
file exists.  Not only is the conditional in test wrong, but the file
is created when it should be being removed.



Bug#864181: Fwd: Bug#864181: os-prober: dmraid detection not functional.

2017-06-07 Thread Philip Hands
Mike Mestnik  writes:

> This does look better, I love the use of operators over if statements.
> I don't think using a temp file is necessary here.  I also wish the
> regex wouldn't ever match a device containing the name of another
> device, in that it should match the surrounding bits.
>
> { dmraid -r -c 2>/dev/null || true } | grep -q "$device" && return 0

The use of the temporary file is there to stop the repeated running of
dmraid, which was the sole purpose of the commit that introduced the
bug, so if one gets rid of that one might as well just revert that
commit.

I agree that there appears to be the potential for $device to match
inappropriately, but I'd need to know something about what dmraid
outputs in order to improve on the grep (I don't have a sataraid machine
to test it on).  Adding a -F option might be a good start.

Cheers, Phil.
-- 
|)|  Philip Hands  [+44 (0)20 8530 9560]  HANDS.COM Ltd.
|-|  http://www.hands.com/http://ftp.uk.debian.org/
|(|  Hugo-Klemm-Strasse 34,   21075 Hamburg,GERMANY


signature.asc
Description: PGP signature


Bug#864181: Fwd: Bug#864181: os-prober: dmraid detection not functional.

2017-06-07 Thread Mike Mestnik
This does look better, I love the use of operators over if statements.
I don't think using a temp file is necessary here.  I also wish the
regex wouldn't ever match a device containing the name of another
device, in that it should match the surrounding bits.

{ dmraid -r -c 2>/dev/null || true } | grep -q "$device" && return 0