1
0
forked from pool/util-linux
OBS User unknown 2007-06-21 22:16:25 +00:00 committed by Git OBS Bridge
parent dc4cdf7b00
commit e81d31f47c
3 changed files with 184 additions and 1 deletions

View File

@ -0,0 +1,172 @@
X-From-Line: mkoenig Thu Jun 21 13:32:01 2007
Return-Path: <kay.sievers@vrfy.org>
Received: from imap.suse.de [195.135.221.23]
by sor.suse.de with IMAP (fetchmail-6.3.5)
for <mkoenig@localhost> (single-drop); Thu, 21 Jun 2007 13:32:01 +0200 (CEST)
Received: from imap.suse.de ([unix socket])
by imap (Cyrus v2.2.12) with LMTPA;
Thu, 21 Jun 2007 13:31:14 +0200
X-Sieve: CMU Sieve 2.2
Received: from Relay2.suse.de (relay2.suse.de [149.44.160.89])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "relay.suse.de", Issuer "CAcert Class 3 Root" (not verified))
by imap.suse.de (Postfix) with ESMTP id 5778914540D0
for <mkoenig@imap.suse.de>; Thu, 21 Jun 2007 13:31:14 +0200 (CEST)
Received: by Relay2.suse.de (Postfix)
id 436A020E91; Thu, 21 Jun 2007 13:31:14 +0200 (CEST)
Received: from emea5-mh.id5.novell.com (emea5-mh.id5.novell.com [149.44.160.113])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(No client certificate requested)
by Relay2.suse.de (Postfix) with ESMTP id 415D620E1C
for <mkoenig@suse.de>; Thu, 21 Jun 2007 13:31:14 +0200 (CEST)
Received: from [192.168.178.22] ([149.44.162.75])
by emea5-mh.id5.novell.com with ESMTP (TLS encrypted); Thu, 21 Jun 2007 13:31:06 +0200
Subject: Re: [PATCH] mount: use encoded labels for volume_id
From: Kay Sievers <kay.sievers@vrfy.org>
To: Matthias Koenig <mkoenig@suse.de>
Cc: util-linux-ng@vger.kernel.org, Karel Zak <kzak@redhat.com>
In-Reply-To: <n7xzm2tk2az.fsf@sor.suse.de>
References: <n7xzm2tk2az.fsf@sor.suse.de>
Content-Type: multipart/mixed; boundary="=-uhU5UxmJBOKYf2ti+EWn"
Date: Thu, 21 Jun 2007 13:31:52 +0200
X-Gnus-Mail-Source: file:~/MAIL/inbox
Message-Id: <1182425512.3436.17.camel@lov.localdomain>
Mime-Version: 1.0
X-Mailer: Evolution 2.10.1
Lines: 132
Xref: sor.suse.de inbox:3392
X-Gnus-Article-Number: 3392 Thu, 21 Jun 2007 14:21:03 +0200
--=-uhU5UxmJBOKYf2ti+EWn
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Thu, 2007-06-21 at 12:52 +0200, Matthias Koenig wrote:
> since udev-112 exports now the label encoding function,
> here is a proposed patch.
> This fixes the problem of user mounts when filsystems
> with unsafe characters are given via LABEL= in fstab.
A patch to do this is already on the list:
http://www.mail-archive.com/util-linux-ng@vger.kernel.org/msg00196.html
I was waiting for Fedora rawhide to catch-up before resending is, so Karel
can at least compile-test it. :)
Configure should check for the new function in the library. Also uuid's may
need escaping with free textual uuids like DDF-raid uses. The probing context
"struct volume_id" should not be accessed directly anymore, if we require a
recent libvolume_id anyway. It will switch to an opaque object some day.
The known_fstype() lookup is also available now, and the TODO can be removed.
Patch attached again.
Thanks,
Kay
--=-uhU5UxmJBOKYf2ti+EWn
Content-Disposition: inline; filename=volume_id_encode.patch
Content-Type: text/x-patch; name=volume_id_encode.patch; charset=utf-8
Content-Transfer-Encoding: 7bit
diff --git a/configure.ac b/configure.ac
index e678773..38c4815 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,7 +87,7 @@ have_volume_id=no
if test x$with_fsprobe = xblkid; then
UTIL_CHECK_LIB(blkid, blkid_known_fstype)
elif test x$with_fsprobe = xvolume_id; then
- UTIL_CHECK_LIB(volume_id, volume_id_open_fd)
+ UTIL_CHECK_LIB(volume_id, volume_id_encode_string)
fi
if test $have_blkid = no && test $have_volume_id = no; then
diff --git a/mount/fsprobe_volumeid.c b/mount/fsprobe_volumeid.c
index 8c13987..4b58e72 100644
--- a/mount/fsprobe_volumeid.c
+++ b/mount/fsprobe_volumeid.c
@@ -20,11 +20,13 @@ enum probe_type {
VOLUME_ID_TYPE,
};
-static char *probe(const char *device, enum probe_type type)
+static char
+*probe(const char *device, enum probe_type type)
{
int fd;
uint64_t size;
struct volume_id *id;
+ const char *val;
char *value = NULL;
fd = open(device, O_RDONLY);
@@ -42,13 +44,16 @@ static char *probe(const char *device, enum probe_type type)
if (volume_id_probe_all(id, 0, size) == 0) {
switch(type) {
case VOLUME_ID_LABEL:
- value = xstrdup(id->label);
+ if (volume_id_get_label(id, &val))
+ value = xstrdup(val);
break;
case VOLUME_ID_UUID:
- value = xstrdup(id->uuid);
+ if (volume_id_get_uuid(id, &val))
+ value = xstrdup(val);
break;
case VOLUME_ID_TYPE:
- value = xstrdup(id->type);
+ if (volume_id_get_type(id, &val))
+ value = xstrdup(val);
break;
default:
break;
@@ -72,10 +77,8 @@ fsprobe_exit(void)
int
fsprobe_known_fstype(const char *fstype)
{
- /* TODO
if (volume_id_get_prober_by_type(fstype) != NULL)
return 1;
- */
return 0;
}
@@ -101,11 +104,15 @@ const char *
fsprobe_get_devname_by_uuid(const char *uuid)
{
char dev[PATH_MAX];
+ size_t len;
if (!uuid)
return NULL;
- snprintf(dev, sizeof(dev), PATH_DEV_BYUUID "/%s", uuid);
+ strcpy(dev, PATH_DEV_BYUUID "/");
+ len = strlen(PATH_DEV_BYUUID "/");
+ if (!volume_id_encode_string(uuid, &dev[len], sizeof(dev) - len) != 0)
+ return NULL;
return canonicalize(dev);
}
@@ -113,11 +120,13 @@ const char *
fsprobe_get_devname_by_label(const char *label)
{
char dev[PATH_MAX];
+ size_t len;
if (!label)
return NULL;
-
- snprintf(dev, sizeof(dev), PATH_DEV_BYLABEL "/%s", label);
+ strcpy(dev, PATH_DEV_BYLABEL "/");
+ len = strlen(PATH_DEV_BYLABEL "/");
+ if (!volume_id_encode_string(label, &dev[len], sizeof(dev) - len) != 0)
+ return NULL;
return canonicalize(dev);
}
-
--=-uhU5UxmJBOKYf2ti+EWn--

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jun 21 14:50:58 CEST 2007 - mkoenig@suse.de
- use encoded label names with volume_id [#232929]
util-linux-2.13-mount_volumeid_label.patch
-------------------------------------------------------------------
Thu Jun 14 10:52:25 CEST 2007 - mkoenig@suse.de

View File

@ -21,7 +21,7 @@ License: BSD License and BSD-like, GNU General Public License (GPL)
Group: System/Base
Autoreqprov: on
Version: 2.12r+git20070530
Release: 5
Release: 6
Summary: A collection of basic system utilities
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%version.tar.bz2
Source2: nologin.c
@ -98,6 +98,7 @@ Patch40: util-linux-2.13-sys_utils_arch.patch
Patch42: util-linux-2.13-build_fix_intel_check.patch
Patch43: util-linux-2.13-misc_utils_cal_ncurses.patch
Patch44: util-linux-2.13-schedutils_chrt.patch
Patch45: util-linux-2.13-mount_volumeid_label.patch
##
## adjtimex
##
@ -157,6 +158,7 @@ Authors:
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
#
cd adjtimex-*
%patch50 -p1
@ -555,6 +557,9 @@ fi
%endif
%changelog
* Thu Jun 21 2007 - mkoenig@suse.de
- use encoded label names with volume_id [#232929]
util-linux-2.13-mount_volumeid_label.patch
* Thu Jun 14 2007 - mkoenig@suse.de
- mkzimage_cmdline: activate commandline if used with -s [#279935]
* Wed Jun 13 2007 - mkoenig@suse.de