From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S3mpz-0006NH-GH for mharc-grub-devel@gnu.org; Sat, 03 Mar 2012 06:09:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3mpw-0006MM-Iv for grub-devel@gnu.org; Sat, 03 Mar 2012 06:09:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3mpu-0002SC-Hk for grub-devel@gnu.org; Sat, 03 Mar 2012 06:09:16 -0500 Received: from mail-ee0-f41.google.com ([74.125.83.41]:53591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3mpu-0002QS-90 for grub-devel@gnu.org; Sat, 03 Mar 2012 06:09:14 -0500 Received: by eeke53 with SMTP id e53so945860eek.0 for ; Sat, 03 Mar 2012 03:09:11 -0800 (PST) Received-SPF: pass (google.com: domain of phcoder@gmail.com designates 10.213.105.70 as permitted sender) client-ip=10.213.105.70; Authentication-Results: mr.google.com; spf=pass (google.com: domain of phcoder@gmail.com designates 10.213.105.70 as permitted sender) smtp.mail=phcoder@gmail.com; dkim=pass header.i=phcoder@gmail.com Received: from mr.google.com ([10.213.105.70]) by 10.213.105.70 with SMTP id s6mr1732339ebo.45.1330772951342 (num_hops = 1); Sat, 03 Mar 2012 03:09:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=gJBR61CvIE8fqgb//gIBWkqsQB14cAaX3c02ntmV3vc=; b=lbQpOztvWLjCPom1fjdCp5Rj/yU6a/xgxL5YmgST48DVMNnlUlApvQT5RhI0Zr6oKx y5Vqhg0idKkWKOHOuSbFB99gDaYVRU+Brfu20tKwWObnXqikOiRFymLgjyrCydKDmESA LVLSYXZdOiAUx1yWTQQayBSDYKmijyRYjL4qhw9xSWqolqunFuFGa2yZcrbBO/tQlD6c Zmdzm/cQnaA8E30fW8r4ztJrs6IDludO6dUlKgSY5yJfblL9ommAX2XrYD8YYy/knncG 2mTtPs7RpZiWM/bDJwFuUJhgeTrfUpZUj52HpeulzDM68NxJmoXc/1Qg3T+ucuf9MvOU A8Nw== Received: by 10.213.105.70 with SMTP id s6mr1330490ebo.45.1330772951196; Sat, 03 Mar 2012 03:09:11 -0800 (PST) Received: from debian.x201.phnet (87-234.197-178.cust.bluewin.ch. [178.197.234.87]) by mx.google.com with ESMTPS id o11sm24250629eef.4.2012.03.03.03.09.09 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 03 Mar 2012 03:09:10 -0800 (PST) Message-ID: <4F51FBD3.3060409@gmail.com> Date: Sat, 03 Mar 2012 12:09:07 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: default menuentry matching similar entries is broken References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.83.41 Cc: Seth Goldberg X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Mar 2012 11:09:18 -0000 On 03.03.2012 08:33, Seth Goldberg wrote: > Hi, > > This code in menu.c::menuentry_eq() looks wrong: > > { > const char *ptr1, *ptr2; > ptr1 = title; > ptr2 = spec; > while (1) > { > if (*ptr2 == '>'&& ptr2[1] != '>'&& *ptr1 == 0) > return 1; > if (*ptr2 == '>'&& ptr2[1] != '>') > return 0; > if (*ptr2 == '>') > ptr2++; > if (*ptr1 != *ptr2) > return 0; > if (*ptr1 == 0)<---- > return 1; > ptr1++; > ptr2++; > } > } > > > Specifically, if there are two menuentries that differ by adding characters, this function will match the wrong one, i.e.: Have you actually tested this? Since from the code readin just before it we have: if (*ptr1 != *ptr2) return 0; So the code you point at is trigered only if both *ptr1 and *ptr2 are 0 > Also, what's the deal with the '>' characters? What are they supposed to do? I can't seem to find the use of'>' documented anywhere. It's for submenus: "submenu>subsubmenu>entry" > > Thanks, > --S > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel > -- Regards Vladimir 'φ-coder/phcoder' Serbinenko