From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1d7jaV-0000Oo-09 for mharc-grub-devel@gnu.org; Mon, 08 May 2017 10:24:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7jaP-0000L8-MN for grub-devel@gnu.org; Mon, 08 May 2017 10:24:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7jaO-0006SC-Pu for grub-devel@gnu.org; Mon, 08 May 2017 10:24:29 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:36175) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7jaO-0006Rx-Iq for grub-devel@gnu.org; Mon, 08 May 2017 10:24:28 -0400 Received: by mail-wr0-x241.google.com with SMTP id v42so8762889wrc.3 for ; Mon, 08 May 2017 07:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-transfer-encoding:message-id; bh=YTo+dW9HQAreQxpQQnsfgLfS+e9inCswI1Y4TSDSwz4=; b=QCTUHqjmuQrkuoTY6jApo8kapBW/Lnw+TFs3qXDJ0qAAQaRsTbsCO1o7JJ3+H8w22s E77uvH26VQIQn15jTP2urbkjIZ3bmi5z2/bPpuDdLhDZeeqigcUjtJt4Nwb+HOzjag2y jE0ADytctcjhdletvBgg/aUGFPPf3EpKXLxyaO86GSiUYNdkf74xtHkCS91yhG0PxVsV GInnwAqJw7IoO0zeZKLyFcAkpvKolbdfurWC8p3LqxW+223vFfRfTwm18/jC7dnBo0kX jI7j6o1nJ/FLyyYuLZCemNVBeBnEX1fMTCsOPpLTRbGHPqE2X6H+Th2+4xErUYJYildi F3ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-transfer-encoding:message-id; bh=YTo+dW9HQAreQxpQQnsfgLfS+e9inCswI1Y4TSDSwz4=; b=iTgdHskGzwGAKJcVxKZ/iNZHCoRS03Y6NR80HuMNRtUNBX2i0R4/ggVXDUVDoBkm+r I7BKi6SkkwYoPUY3Z9lJiPLN1z/XWox3lwGdje/TezydzZgyLpotANL/aR30JVbo0mr7 Gb6VX0ITR65z6/RFbPIV6KjBQ+jrddZ/rNo6J3MJwnGm76zsDWBlEyblHF1xWa03UUqn 08T3NQmJgZeZTdwkx5LOTqXmMj75Fm13NFcJPMhL2EEGFUDGjdjOz3fcdPkCKY4wfiJq TSsHG9jsDtDgFadf6PBjDGL/9Ndjo2c75D5LFI76CvQ3b0Dt1t7xTbbGqFV4XZW2SxRO Z7cg== X-Gm-Message-State: AN3rC/7CWNUwoEa5UgMuFPqTizK+AcfEreZNoAn74emNxdhz94ceqgZD Cepe3hK9hT3sag== X-Received: by 10.223.148.35 with SMTP id 32mr32174981wrq.175.1494253467481; Mon, 08 May 2017 07:24:27 -0700 (PDT) Received: from pali-latitude.localnet ([2001:718:1e03:a01::1ca]) by smtp.gmail.com with ESMTPSA id j124sm11875664wmg.13.2017.05.08.07.24.25 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 May 2017 07:24:25 -0700 (PDT) From: Pali =?utf-8?q?Roh=C3=A1r?= To: "Vladimir 'phcoder' Serbinenko" Subject: Re: [PATCH] * grub-core/fs/udf.c: Add support for UUID Date: Mon, 8 May 2017 16:24:24 +0200 User-Agent: KMail/1.13.7 (Linux/3.13.0-117-generic; KDE/4.14.2; x86_64; ; ) Cc: The development of GNU GRUB References: <1491849330-10140-1-git-send-email-pali.rohar@gmail.com> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2706048.XPPJtbjXZA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201705081624.24841@pali> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 May 2017 14:24:30 -0000 --nextPart2706048.XPPJtbjXZA Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Monday 08 May 2017 15:13:28 Vladimir 'phcoder' Serbinenko wrote: > On Mon, Apr 10, 2017, 23:17 Pali Roh=C3=A1r wrote: > > char *outbuf, int normalize_utf8) >=20 > Normalize isn't the right word. And it's not utf-8 but latin1 (called > compressed utf-16 by udf docs). Without this patch part read_string() expects that input string is=20 either utf-8 or utf-16 in that compressed osta form. If input string is=20 marked with leading 0x8 but contains invalid UTF-8 sequence (like chars=20 80-FF) then it is treated as Latin1 and converted to UTF-8 in output. So=20 input "\x80" is returned as "\xC2\x80". What I need is to do not do this Latin1 --> UTF-8 conversion if input is=20 marked with leading 0x8 and stay it in binary/raw/octets form. This is=20 due to older versions of mkudffs which put into volset string not=20 conforming to osta spec. libblkid do not do that "\x80" --> "\xC2\x80"=20 conversion too so it is better to have same algorithm for providing UUID=20 on running system (blkid on Linux) and in bootloader (Grub2). > Are you sure you handle utf-16 case correctly? What is the expected > behavior in those cases? Ideally you may want to just parse raw > string in caller If volsetid is stored according to osta spec, then it is handed=20 correctly (both UTF-8 and UTF-16). > > + binpos =3D 16; > > + for (i =3D 0; i < len; ++i) > > + { > > + if (!grub_isalnum (buf[i])) >=20 > That looks real weird. What if first byte of UUID is 'a'? What if > alnum part contains non-English chars. > I have to admit I don't get what expected behaviour is. Can you > elaborate on this and enable UUID test in udf_test to check that > UUID matches blkid? According to osta spec, first 16 characters of volsetid are unique and=20 remaining anything. First 8 characters are hexadecimal representation of=20 32bit timestamp and remaining 8 implementation free (but still are=20 unique). Therefore those first 16 characters we use for generating UUID. Again some generators of UDF disks do not put there hexadecimal number,=20 but some garbage (sometimes not valid UTF-8...) so this code generates=20 alphanumeric UUID from input with fact that in most cases is input=20 hexadecimal (so used as is). If you have other idea how to deal with this, let me know... =2D-=20 Pali Roh=C3=A1r pali.rohar@gmail.com --nextPart2706048.XPPJtbjXZA Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAlkQf5gACgkQi/DJPQPkQ1J/DwCbByHup5UmFtyykhhjC2lwctjW 6XMAni8vCvDllCav7BW2TcGkV8NodW74 =ho+y -----END PGP SIGNATURE----- --nextPart2706048.XPPJtbjXZA--