rpms/util-linux-ng/F-12 util-linux-ng-2.16-libblkid-joliet.patch, NONE, 1.1 util-linux-ng.spec, 1.60, 1.61
kzak
kzak at fedoraproject.org
Fri Oct 2 19:24:34 UTC 2009
Author: kzak
Update of /cvs/pkgs/rpms/util-linux-ng/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29519
Modified Files:
util-linux-ng.spec
Added Files:
util-linux-ng-2.16-libblkid-joliet.patch
Log Message:
* Fri Oct 2 2009 Karel Zak <kzak at redhat.com> 2.16-10.1
- #514413 - Extra spaces at the end of CD mount point
util-linux-ng-2.16-libblkid-joliet.patch:
probe.c | 32 +++++++++++++++++++++-----------
probers/iso9660.c | 26 +++++++++++++++++++++++---
2 files changed, 44 insertions(+), 14 deletions(-)
--- NEW FILE util-linux-ng-2.16-libblkid-joliet.patch ---
diff -up util-linux-ng-2.16/shlibs/blkid/src/probe.c.kzak util-linux-ng-2.16/shlibs/blkid/src/probe.c
--- util-linux-ng-2.16/shlibs/blkid/src/probe.c.kzak 2009-07-04 01:20:03.000000000 +0200
+++ util-linux-ng-2.16/shlibs/blkid/src/probe.c 2009-10-02 20:53:33.000000000 +0200
@@ -685,10 +685,27 @@ static int blkid_probe_set_usage(blkid_p
return blkid_probe_set_value(pr, "USAGE", (unsigned char *) u, strlen(u) + 1);
}
+
+/* Removes whitespace from the right-hand side of a string (trailing
+ * whitespace).
+ *
+ * Returns size of the new string (without \0).
+ */
+static size_t blkid_rtrim_whitespace(unsigned char *str)
+{
+ size_t i = strlen((char *) str);
+
+ while (i--) {
+ if (!isspace(str[i]))
+ break;
+ }
+ str[++i] = '\0';
+ return i;
+}
+
int blkid_probe_set_label(blkid_probe pr, unsigned char *label, size_t len)
{
struct blkid_prval *v;
- int i;
if (len > BLKID_PROBVAL_BUFSIZ)
len = BLKID_PROBVAL_BUFSIZ;
@@ -704,15 +721,7 @@ int blkid_probe_set_label(blkid_probe pr
memcpy(v->data, label, len);
v->data[len] = '\0';
-
- /* remove trailing whitespace */
- i = strnlen((char *) v->data, len);
- while (i--) {
- if (!isspace(v->data[i]))
- break;
- }
- v->data[++i] = '\0';
- v->len = i + 1;
+ v->len = blkid_rtrim_whitespace(v->data) + 1;
return 0;
}
@@ -765,7 +774,8 @@ int blkid_probe_set_utf8label(blkid_prob
if (!v)
return -1;
- v->len = encode_to_utf8(enc, v->data, sizeof(v->data), label, len);
+ encode_to_utf8(enc, v->data, sizeof(v->data), label, len);
+ v->len = blkid_rtrim_whitespace(v->data) + 1;
return 0;
}
diff -up util-linux-ng-2.16/shlibs/blkid/src/probers/iso9660.c.kzak util-linux-ng-2.16/shlibs/blkid/src/probers/iso9660.c
--- util-linux-ng-2.16/shlibs/blkid/src/probers/iso9660.c.kzak 2009-07-04 01:20:02.000000000 +0200
+++ util-linux-ng-2.16/shlibs/blkid/src/probers/iso9660.c 2009-10-02 20:54:43.000000000 +0200
@@ -19,6 +19,7 @@
#include "blkidP.h"
+/* PVD - Primary volume descriptor */
struct iso_volume_descriptor {
unsigned char vd_type;
unsigned char vd_id[5];
@@ -48,6 +49,20 @@ struct high_sierra_volume_descriptor {
unsigned char volume_id[32];
};
+/* returns 1 if the begin of @ascii is equal to @utf16 string.
+ */
+static int ascii_eq_utf16be(unsigned char *ascii,
+ unsigned char *utf16, size_t len)
+{
+ int a, u;
+
+ for (a = 0, u = 0; u < len; a++, u += 2) {
+ if (utf16[u] != 0x0 || ascii[a] != utf16[u + 1])
+ return 0;
+ }
+ return 1;
+}
+
/* old High Sierra format */
static int probe_iso9660_hsfs(blkid_probe pr, const struct blkid_idmag *mag)
{
@@ -82,8 +97,6 @@ static int probe_iso9660(blkid_probe pr,
/* Joliet Extension */
off = ISO_VD_OFFSET;
for (i = 0; i < ISO_VD_MAX; i++) {
- uint8_t svd_label[64];
-
iso = (struct iso_volume_descriptor *)
blkid_probe_get_buffer(pr,
off,
@@ -98,9 +111,16 @@ static int probe_iso9660(blkid_probe pr,
memcmp(iso->escape_sequences, "%/C", 3) == 0 ||
memcmp(iso->escape_sequences, "%/E", 3) == 0) {
+ /* Is the Joliet (UTF16BE) label equal to the label in
+ * the PVD? If yes, use PVD label. The Jolied version
+ * of the label could be trimed (because UTF16..).
+ */
+ if (ascii_eq_utf16be(label, iso->volume_id, 32))
+ break;
+
blkid_probe_set_utf8label(pr,
iso->volume_id,
- sizeof(svd_label),
+ sizeof(iso->volume_id),
BLKID_ENC_UTF16BE);
blkid_probe_set_version(pr, "Joliet Extension");
Index: util-linux-ng.spec
===================================================================
RCS file: /cvs/pkgs/rpms/util-linux-ng/F-12/util-linux-ng.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -p -r1.60 -r1.61
--- util-linux-ng.spec 16 Sep 2009 19:04:11 -0000 1.60
+++ util-linux-ng.spec 2 Oct 2009 19:24:34 -0000 1.61
@@ -2,7 +2,7 @@
Summary: A collection of basic system utilities
Name: util-linux-ng
Version: 2.16
-Release: 10%{?dist}
+Release: 10.1%{?dist}
License: GPLv2 and GPLv2+ and BSD with advertising and Public Domain
Group: System Environment/Base
URL: ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng
@@ -114,6 +114,8 @@ Patch10: util-linux-ng-2.16-libblkid-com
Patch11: util-linux-ng-2.14-sfdisk-dump.patch
# Swsuspend does not work
Patch12: util-linux-ng-2.16-blkid-swsuspend.patch
+# 514413 - Extra spaces at the end of CD mount point
+Patch13: util-linux-ng-2.16-libblkid-joliet.patch
%description
The util-linux-ng package contains a large variety of low-level system
@@ -212,6 +214,7 @@ cp %{SOURCE8} %{SOURCE9} .
%patch10 -p1
%patch11 -p1
%patch12 -p1
+%patch13 -p1
%build
unset LINGUAS || :
@@ -722,6 +725,9 @@ fi
%changelog
+* Fri Oct 2 2009 Karel Zak <kzak at redhat.com> 2.16-10.1
+- #514413 - Extra spaces at the end of CD mount point
+
* Wed Sep 16 2009 Tomas Mraz <tmraz at redhat.com> - 2.16-10
- use password-auth common PAM configuration instead of system-auth and
drop pam_console.so call from the remote PAM config file
More information about the fedora-extras-commits
mailing list