Hello community, here is the log from the commit of package hal checked in at Sun May 21 19:03:33 CEST 2006. -------- --- hal/hal.changes 2006-05-04 19:50:40.000000000 +0200 +++ hal/hal.changes 2006-05-19 16:41:47.000000000 +0200 @@ -1,0 +2,12 @@ +Fri May 19 16:18:29 CEST 2006 - dkukawka@suse.de + +- added patches: + - hal-fix-mount_device_fstab_with_user_option_172870.diff: fix + for bug #172870 to allow mount partitions which are in fstab + with option user + - hal-fix_workaround_libhal-strage_get_volume_size.diff: fix for + bug #177078 to workaround devices which return wrong BLKSSZGET + values. If now the value from (block_size * num_blocks) is + bigger than the value from sysfs we use the sysfs value. + +------------------------------------------------------------------- New: ---- hal-fix-mount_device_fstab_with_user_option_172870.diff hal-fix_workaround_libhal-strage_get_volume_size.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hal.spec ++++++ --- /var/tmp/diff_new_pack.gozuGT/_old 2006-05-21 19:03:23.000000000 +0200 +++ /var/tmp/diff_new_pack.gozuGT/_new 2006-05-21 19:03:23.000000000 +0200 @@ -19,7 +19,7 @@ License: Other License(s), see package, Other uncritical OpenSource License Group: System/Daemons Version: 0.5.6 -Release: 32 +Release: 33 Autoreqprov: on Summary: Daemon for Collecting Hardware Information # SUSE specific patches @@ -32,6 +32,7 @@ Patch6: %{name}-fix-mount-sanitze-mountpoint.diff Patch7: %{name}-performance-properties2.diff Patch8: %{name}-fix-mount_on_dev_wo_media_check_support.diff +Patch9: %{name}-fix-mount_device_fstab_with_user_option_172870.diff # submitted upstream patches Patch10: hal-update-copyright_header.diff Patch11: hal-fix-mount_script_v4.diff @@ -51,6 +52,7 @@ Patch25: hal-fix-apm-poll_battery_reduce_events.diff Patch26: hal-add-debug_to_syslog_probing_v2.diff Patch27: hal-fix-probe_smbios_parse_bug172204.diff +Patch28: hal-fix_workaround_libhal-strage_get_volume_size.diff # external patches from HAL List and backports Patch100: hal-add-scsi-type.diff Patch101: hal-fix-SG_IO_bug145147.diff @@ -181,6 +183,8 @@ %patch8 %patch26 %patch27 +%patch28 +%patch9 #%patch200 #rm -rf py-compile 4> /dev/null || : #ln -s /usr/share/automake-1.9/py-compile py-compile 2> /dev/null || : @@ -296,6 +300,15 @@ %{_bindir}/hal-device-manager %changelog -n hal +* Fri May 19 2006 - dkukawka@suse.de +- added patches: +- hal-fix-mount_device_fstab_with_user_option_172870.diff: fix + for bug #172870 to allow mount partitions which are in fstab + with option user +- hal-fix_workaround_libhal-strage_get_volume_size.diff: fix for + bug #177078 to workaround devices which return wrong BLKSSZGET + values. If now the value from (block_size * num_blocks) is + bigger than the value from sysfs we use the sysfs value. * Thu May 04 2006 - dkukawka@suse.de - added patches: - hal-add-debug_to_syslog_probing_v2.diff: add debug to syslog ++++++ hal-fix-mount_device_fstab_with_user_option_172870.diff ++++++ --- tools/hal-system-storage-mount 2006-05-19 13:22:55.000000000 +0200 +++ tools/hal-system-storage-mount 2006-05-19 13:30:28.000000000 +0200 @@ -35,36 +35,42 @@ exit 1 fi - check_fstab() { - awk -v dev="$1" \ + awk -v dev="$1" -v mp="$2"\ ' BEGIN { sub(/^\/dev\//,"", dev) - cmd = "/usr/bin/udevinfo -q symlink -n " dev - if (( cmd | getline) < 0 ) { - print "org.freedesktop.Hal.Device.Volume.PermissionDenied" >/dev/stderr - exit 1 - } - + ("/usr/bin/udevinfo -q symlink -n " dev " 2> /dev/null") | getline for(i=1; i <= NF; i++) { a["/dev/" $i] = 1 } a["/dev/" dev] = 1 } { - if ($1 in a) { + if ($1 in a) { + # "user" option is needed + n = split ($4, options, ",") + for (i = 1; i <= n; i++) { + if (options[i] == "user") { + # return specified mountpoint if below /media + mount = $2 + if (match(mount, "^/media/") > 0) { + sub(/^\/media\//,"", mount) + print mount + exit 0 + } + } + } + print "org.freedesktop.Hal.Device.Volume.PermissionDenied" >"/dev/stderr" - print $1 " found in /etc/fstab" >"/dev/stderr" + print "/etc/fstab configuration does not allow unprivileged operation" >"/dev/stderr" exit 1 } } ' /etc/fstab } -check_fstab "$HAL_PROP_BLOCK_DEVICE" || exit 1 - # read parameters # "MyDisk\n" # "fuse\n" @@ -78,6 +84,21 @@ read GIVEN_MOUNTOPTIONS GIVEN_MOUNTOPTIONS=${GIVEN_MOUNTOPTIONS//[^a-zA-Z0-9_=[:space:]]/_} +# deny to handle devices listed in fstab, unless the "user" option is given +# allow only use of specified mountpoint and fail for a different one +FSTAB_MOUNTPOINT=$(check_fstab "$HAL_PROP_BLOCK_DEVICE") || exit 1 +if [ -n "$FSTAB_MOUNTPOINT" ]; then + # fail if we got a request for a different mountpoint + if [ -n "$GIVEN_MOUNTPOINT" ] && [ "$GIVEN_MOUNTPOINT" != "$FSTAB_MOUNTPOINT" ]; then + echo "org.freedesktop.Hal.Device.Volume.PermissionDenied" >&2 + echo "/etc/fstab configuration does not allow this mountpoint" >&2 + exit 1; + fi + # use mountpoint from fstab + GIVEN_MOUNTPOINT="$FSTAB_MOUNTPOINT" +fi + +# if no mountpoint is given, use filesystem label, or drive_type, or "disk" if [ -z "$GIVEN_MOUNTPOINT" ]; then if [ -n "$HAL_PROP_VOLUME_LABEL" ]; then GIVEN_MOUNTPOINT="$HAL_PROP_VOLUME_LABEL" @@ -134,9 +155,13 @@ esac fi -# if no type is given, use default name +# if no type is given, use default type, or let the kernel find out if [ "$MOUNTTYPE" == "" ]; then - MOUNTTYPE=$HAL_PROP_VOLUME_FSTYPE + if [ "$HAL_PROP_VOLUME_FSTYPE" != "" ]; then + MOUNTTYPE=$HAL_PROP_VOLUME_FSTYPE + else + MOUNTTYPE="auto" + fi fi # retrieve white-list from device properties (see fdi/policy/osvendor/20-storage-methods.fdi) @@ -186,16 +211,23 @@ /usr/lib64/hal/scripts/hal-system-storage-cleanup-mountpoints fi -# append number to mountpoint if it already exists -if [ -e "$MOUNT_ROOT/$MOUNTPOINT" ]; then - NUM=1; +# append number to mountpoint if it is already in use +while read dev dir type options; do + if [ "$dir" = "$MOUNT_ROOT/$MOUNTPOINT" ]; then + MOUNTPOINT_BUSY=1 + break; + fi +done < /proc/mounts +if [ -n "$MOUNTPOINT_BUSY" ]; then + NUM=1 while [ -e "$MOUNT_ROOT/$MOUNTPOINT-$NUM" ]; do NUM=$(($NUM + 1)) done MOUNTPOINT="$MOUNTPOINT-$NUM" fi -# create directory and mark it for cleanup with an extended attribute +# possibly create mountpoint directory and mark it for +# later cleanup, if we did create it if [ ! -e "$MOUNT_ROOT/$MOUNTPOINT" ]; then MOUNTPOINT_CREATED=1 mkdir "$MOUNT_ROOT/$MOUNTPOINT" ++++++ hal-fix_workaround_libhal-strage_get_volume_size.diff ++++++ Index: libhal-storage/libhal-storage.c =================================================================== RCS file: /cvs/hal/hal/libhal-storage/libhal-storage.c,v retrieving revision 1.35 diff -u -3 -p -u -r1.35 libhal-storage.c --- libhal-storage/libhal-storage.c 9 May 2006 20:28:01 -0000 1.35 +++ libhal-storage/libhal-storage.c 19 May 2006 13:16:02 -0000 @@ -737,7 +737,6 @@ struct LibHalVolume_s { int msdos_part_table_type; - dbus_bool_t is_disc; LibHalVolumeDiscType disc_type; dbus_bool_t disc_has_audio; @@ -758,6 +757,8 @@ struct LibHalVolume_s { char *crypto_backing_volume; char mount_options[MOUNT_OPTIONS_SIZE]; + + dbus_uint64_t volume_size; }; const char * @@ -850,6 +851,7 @@ out: #define LIBHAL_PROP_EXTRACT_BEGIN if (FALSE) #define LIBHAL_PROP_EXTRACT_END ; #define LIBHAL_PROP_EXTRACT_INT(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_INT32) _where_ = libhal_psi_get_int (&it) +#define LIBHAL_PROP_EXTRACT_UINT64(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_UINT64) _where_ = libhal_psi_get_uint64 (&it) #define LIBHAL_PROP_EXTRACT_STRING(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_STRING) _where_ = (libhal_psi_get_string (&it) != NULL && strlen (libhal_psi_get_string (&it)) > 0) ? strdup (libhal_psi_get_string (&it)) : NULL #define LIBHAL_PROP_EXTRACT_BOOL(_property_, _where_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_BOOLEAN) _where_ = libhal_psi_get_bool (&it) #define LIBHAL_PROP_EXTRACT_BOOL_BITFIELD(_property_, _where_, _field_) else if (strcmp (key, _property_) == 0 && type == LIBHAL_PROPERTY_TYPE_BOOLEAN) _where_ |= libhal_psi_get_bool (&it) ? _field_ : 0 @@ -1106,6 +1108,7 @@ libhal_volume_from_udi (LibHalContext *h LIBHAL_PROP_EXTRACT_INT ("volume.block_size", vol->block_size); LIBHAL_PROP_EXTRACT_INT ("volume.num_blocks", vol->num_blocks); + LIBHAL_PROP_EXTRACT_UINT64 ("volume.size", vol->volume_size); LIBHAL_PROP_EXTRACT_STRING ("volume.label", vol->volume_label); LIBHAL_PROP_EXTRACT_STRING ("volume.mount_point", vol->mount_point); LIBHAL_PROP_EXTRACT_STRING ("volume.fstype", vol->fstype); @@ -1320,7 +1323,14 @@ out: dbus_uint64_t libhal_volume_get_size (LibHalVolume *volume) { - return ((dbus_uint64_t)volume->block_size) * ((dbus_uint64_t)volume->num_blocks); + dbus_uint64_t computed_size; + + computed_size = ((dbus_uint64_t)volume->block_size) * ((dbus_uint64_t)volume->num_blocks); + + if ((computed_size > volume->volume_size) && (volume->volume_size > 0)) + return volume->volume_size; + else + return computed_size; } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun...
participants (1)
-
root@suse.de