[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#772901: marked as done (os-prober wrong output with grep 2.21 or later)



Your message dated Wed, 18 Jan 2017 16:38:24 +0000
with message-id <20170118163824.GA5403@riva.ucam.org>
and subject line Re: Bug#772901: os-prober wrong output with grep 2.21 or later
has caused the Debian Bug report #772901,
regarding os-prober wrong output with grep 2.21 or later
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
772901: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=772901
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: os-prober
Version: 1.65
Tags: patch

os-prober uses 'grep' in an unportable way, in that it assumes that the regular expression "." matches the NUL byte (all zero bits). POSIX doesn't guarantee this, and as of grep 2.21 this might not work. If os-prober assumes GNU grep the fix should be fairly straightforward; please see the attached (untested) patch. If os-prober is intended to be portable to non-GNU grep, more hacking will be needed, as POSIX says grep has undefined behavior when given binary input data.

For more details about this issue please see:

https://bugzilla.redhat.com/show_bug.cgi?id=1172405
https://bugzilla.redhat.com/show_bug.cgi?id=1172804
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19348
diff -pru os-prober/os-probes/mounted/x86/20microsoft os-prober-fix/os-probes/mounted/x86/20microsoft
--- os-prober/os-probes/mounted/x86/20microsoft	2014-11-12 07:19:18.000000000 -0800
+++ os-prober-fix/os-probes/mounted/x86/20microsoft	2014-12-11 19:25:06.749770598 -0800
@@ -31,19 +31,19 @@ if item_in_dir -q bootmgr "$2"; then
 	for boot in $(item_in_dir boot "$2"); do
 		bcd=$(item_in_dir bcd "$2/$boot")
 		if [ -n "$bcd" ]; then
-			if grep -qs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
+			if grep -aqs "W.i.n.d.o.w.s. .8" "$2/$boot/$bcd"; then
 				long="Windows 8 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .7" "$2/$boot/$bcd"; then
 				long="Windows 7 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .V.i.s.t.a" "$2/$boot/$bcd"; then
 				long="Windows Vista (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8. .R.2." "$2/$boot/$bcd"; then
 				long="Windows Server 2008 R2 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .S.e.r.v.e.r. .2.0.0.8." "$2/$boot/$bcd"; then
 				long="Windows Server 2008 (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .R.e.c.o.v.e.r.y. .E.n.v.i.r.o.n.m.e.n.t" "$2/$boot/$bcd"; then
 				long="Windows Recovery Environment (loader)"
-			elif grep -qs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
+			elif grep -aqs "W.i.n.d.o.w.s. .S.e.t.u.p" "$2/$boot/$bcd"; then
 				long="Windows Recovery Environment (loader)"
 			else
 				long="Windows Vista (loader)"
diff -pru os-prober/os-probes/mounted/x86/83haiku os-prober-fix/os-probes/mounted/x86/83haiku
--- os-prober/os-probes/mounted/x86/83haiku	2014-09-28 14:04:17.000000000 -0700
+++ os-prober-fix/os-probes/mounted/x86/83haiku	2014-12-11 19:32:45.177765083 -0800
@@ -13,7 +13,7 @@ case "$type" in
 	*) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
 esac
 
-if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then
+if head -c 512 "$partition" | grep -aqs "system.haiku_loader"; then
 	debug "Stage 1 bootloader found"
 else
 	debug "Stage 1 bootloader not found: exiting"

--- End Message ---
--- Begin Message ---
Source: os-prober
Source-Version: 1.66

On Thu, Dec 11, 2014 at 07:45:29PM -0800, Paul Eggert wrote:
> os-prober uses 'grep' in an unportable way, in that it assumes that the
> regular expression "." matches the NUL byte (all zero bits).  POSIX doesn't
> guarantee this, and as of grep 2.21 this might not work.  If os-prober
> assumes GNU grep the fix should be fairly straightforward; please see the
> attached (untested) patch.  If os-prober is intended to be portable to
> non-GNU grep, more hacking will be needed, as POSIX says grep has undefined
> behavior when given binary input data.

Thanks.  An identical patch seems to have been applied in os-prober 1.66
in response to a later bug report, so closing this bug.

os-prober (1.66) unstable; urgency=medium

  * Add -a flag to grep -qs for Windows Vista detection. It appears the
    file isn't always considered as a text file, so this should be more
    robust. Thanks to Gianluigi Tiesi for the report and the suggestion
    (Closes: #791383).

 -- Cyril Brulebois <kibi@debian.org>  Fri, 10 Jul 2015 01:34:23 +0200

-- 
Colin Watson                                       [cjwatson@debian.org]

--- End Message ---

Reply to: